I have a grid with a store and a loader. There is a paging tool bar too. Now when I click on the refresh button from the paging tool bar, the selection goes. I need to maintain this selection after refresh.
Solution:
1. First superclass the PagingToolBar class like here:
public MyPagingToolBar extends PagingToolBar { public Button getRefreshButton() { return refresh; } }
2. Secondly, add a "Select" or "BeforeSelect" event listener on the refresh button, like in this code extract:
MyPagingToolBar toolbar = new MyPagingToolBar (); toolbar.getRefreshButton().addListener (Events.Select, new Listner<ButtonEvent>(){ public void handleEvent (ButtonEvent be) { /* here you save your selection row */ } });
3. On the grid loader success notification you can re-select the row programatically.
gridLoader = new BasePagingLoader<pagingloadresult<modeldata>>(proxy, reader) { protected void onLoadFailure(Object loadConfig, Throwable t) { super.onLoadFailure(loadConfig, t); } protected void onLoadSuccess(Object loadConfig, PagingLoadResultCheers!result) { super.onLoadSuccess(loadConfig, result); /* here you do the re-selection */ } });
Participant
No comments:
Post a Comment