flex - Sorting in Advanced Datagrid -


i have advanced datagrid sorting. think string sorting default. need sorting in number. how can achieve number sorting?

for example: have row numbers 1 100 . need number sorting 1,10,100.

in advanceddatagridcolumn add sortcomparefunction:

<mx:advanceddatagridcolumn sortcomparefunction="numbersorter"  sortdescending="true" datafield="number" headertext="formal name" width="280"/>   

add function somewhere in scripts

<mx:script>     <![cdata[          import mx.utils.objectutil         public function numbersorter(itema:object, itemb:object):int{         return objectutil.numericcompare(itema.number, itemb.number);     }      ]]> </mx:script> 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -