views:

86

answers:

1

Hi all,

I am creating a Datagrid in AS3, and adding a sort function to a column. However, this sort function does never get called. Any ideas?

   dg_gruppenUebersicht = new NestedDataGrid;
   dg_gruppenUebersicht.sortableColumns = true;
   dg_gruppenUebersicht.dataProvider = arrCol_gruppenTnAkt;
   dg_gruppenUebersicht.columns = new Array;
   var cols : Array = dg_gruppenUebersicht.columns;

   //initalize datagrid
   var dgc : DataGridColumn = new DataGridColumn( "Jahrgang" );
   dgc.dataField = "TnJahrgang";
   dgc.labelFunction = MyFormatter.lblfunc_alter2jahrgang;
   dgc.sortable = true;
   dgc.sortCompareFunction = compareFunc_tnJahrgang;
   dgc.headerText = "Alter";
   dgc.headerRenderer = new ClassFactory( at.moschitz.VDGHeader );
   dgc.width = 20;
   cols.push( dgc );

   dg_gruppenUebersicht.columns = cols;

Strangely, the label function gets called.

Thanks Martin

A: 

Try calling arrCol_gruppenTnAkt.refresh(); at the end.

Are there other columns in the data grid? If so, did you click on the dgc column so that the grid is sorted as per this column?

Amarghosh
Yes, there are other columns...and regardless which ones I click, the sorting is not working as expected.in debugging mode, the custom sort function is never called...
martin
arrCol_gruppenTnAkt.refresh(); didn't work?
Amarghosh
no, that did not work. Maybe I need to add a click handler on other header and do a manual refresh?But thats weird, it should take the sortfunction, like when you add it in MXML.
martin