How to disable automatic sorting in Editable Datagrid in Flex 4

不打扰是莪最后的温柔 提交于 2019-12-23 17:29:46

问题


I have an editable datagrid. If sorting is applied by clicking any header of datagrid, it works fine. But after that, if data values are changed in any row of datagrid, sorting is applied automatically. How to prevent from this behaviour? i.e. sorting should only be applied if user clicks on any header of datagrid and sorting should not be applied when user modifies data in grid.


回答1:


You have to set sortableColumns to false and handle the headerRelease event, where you do the sorting manually on the data source.

<mx:DataGrid sortableColumns="false" headerRelease="onHeaderRelease(event)" ...



回答2:


just call Object(owner).dataProvider.disableAutoUpdate() before committing the value in your item editor.




回答3:


I know that you're asking this issue in Flex 4 but I hope the solution that I found in Flex 3 will help.

I also had the same exact problem but then I realized that something in the data must be triggering the sorting to happen. And it turned out that I was setting the data to be [Bindable]. This made sense to see sorting happened automatically because the value change dispatch propertyChange event.

If you do need to make the data to be [Bindable], use custom binding: http://livedocs.adobe.com/flex/3/html/help.html?content=ascomponents_4.html



来源:https://stackoverflow.com/questions/5228933/how-to-disable-automatic-sorting-in-editable-datagrid-in-flex-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!