I am attemtping to use the sortItemsOn() function as shown in the code below to make it so that after the DataProvider changes data and triggers a CollectionEvent, that the order the datagrid displays the data is descending instead of ascending.

            private function onDataGridDataChange(evt:CollectionEvent):void
                Alert.show("I made it here");

<mx:DataGrid id="table" width="100%" height="100%">
                            <mx:DataGridColumn dataField="@feature1`" headerText="col1"  />
                            <mx:DataGridColumn dataField="@feature2" headerText="col2" />

The Alert in the function will show when the XMLList gets updated automatically, however, the sort is still the same. My end goal is to make it so that the order of the sort is descending instead of ascending. I am under the impression I might not be passing in the correct parameters. However I can't be certain. How do I use the function to have it sort in descending order after the dataProvider when the function is called in response to a change of data?

0 Answers