开发者

How do I keep selection after refresh in datagrid flex?

开发者 https://www.devze.com 2023-03-10 16:28 出处:网络
My datagrid is filled with data from an Oracle database. The datagrid ref开发者_如何学Pythonreshes after 1 min. After that, I lose the selected item. I want to avoid that. Consider that it\'s quite po

My datagrid is filled with data from an Oracle database. The datagrid ref开发者_如何学Pythonreshes after 1 min. After that, I lose the selected item. I want to avoid that. Consider that it's quite possible that there is new data after refresh, so the selected index may no longer appear in the datagrid after a refresh.


You didn't say how the DataGrid was being refreshed; whether this is something automatic or something you've built. But, in essence, do this:

// before the refresh
storedSelectedItem = dataGridInstance.selectedItem;

// perform code to do the refresh

// after the refresh
dataGridInstance.selectedItem = storedSelectedItem
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号