4 Replies Latest reply on Mar 31, 2010 4:33 PM by Flex harUI

    Flex 4 DataGrid sortCompareFunction not working like Flex 3

    matn1 Level 1

      I was wondering if there is a bug or something changed beween versions?

      Is there a workaround?


      If so is there a workaround to make it more Generic

      As previously asked

        the following was working in Flex 3 where you could wrap a function reference and pass and aquire params from the function call

              public function caselessSortForField(field:String):Function
                  return function(obj1:Object, obj2:Object):int
                      return ObjectUtil.stringCompare(obj1[field], obj2[field], true);



            <mx:DataGridColumn dataField="index"
                                     sortCompareFunction="caselessSortForField('index')" />


      However in Flex 4 I get 1120: Access of undefined property caselessSortForField('index') even when using Flex3 compatibility


      It just wants a single funtion sortCompareFunction="caselessSortForField" without params.

      The problem with this is its difficult to re-use. I need a seperate sortFunction for each DataGridColumn


      Is there a workaround?