I have a dataGrid custom component, and an arracyCollection as the dataProvider. Because of the behaviour we have had to customize in the DG, the default grid column sorting is not the behaviour we are looking for. For the most part, the DG is not editable, and we have an "edit' button that allows the data to be edited, or added to.
What I'm needing to do is to allow the grid to be sorted by one column when the grid is NOT editable, and then when the user clicks EDIT, any new entries are only added to the bottom of the list. We are finding that the default column sorting will automatically sort the new entries.
My question is: if I apply the SortField and Sort to the AC, will that sort continue as items are added? If so, can I do anything to prevent this?
Reset the AC like this:
Dg.dataProvider = Dg.dataProvider.toArray();
Yes, the Sort will keep getting applied when adding new elements.
To prevent this behaviour, another solution than previous response is to reset the Sort :
var sort:Sort = new Sort(); sort.fields = ; myArrayCollection.sort = sort; myArrayCollection.refresh();
Not sure if the sort.fields =  is needed though. The refresh() call forces the new sort to be applied.