Datagrid Flex sorting not saved when data changes

I have a flexible datagrid. it is associated with an array. if the user sorts by column X, it works fine. then, if the user causes a change to the collection of the array, the datagrid forgets that it has been sorted by column X.

what do i need to do to save this sort so that the new array data is sorted by column X?

+3
source share
4 answers

I posted this question on another forum and got a good answer that worked well. Here it is:

If your data is in an ArrayCollections, you can assign the ListCollectionView to the dataProvider property of your child AdvancedDataGrid and assign ArrayCollection data to the "list" ListCollectionView property. When you want to change data in a child grid, reassign the ListCollectionView property of the list. This way you avoid reassigning the dataProvider of the child grid directly, which causes the grid to reset.

here is the link to the post: http://forums.adobe.com/message/2206736#2206736

+3
source

It really helped, thanks. But do not forget Refresh() dataProviderafter you have reset sorting:

dataGrid.dataProvider.refresh();
+1
source

, , , ...

selectedItems=dataGrid.selectedItems;

postionGrid=dataGrid.verticalScrollPosition;

sortPostionGrid=dataGrid.dataProvider.sort;

, , , ,

0

This post " Keeping sorting by datagrid when changing the DataProvider , gives

more relevant and effective solution what you are looking for

Hopes that help

0
source

Source: https://habr.com/ru/post/1716149/


All Articles