PDA

View Full Version : How to refresh paging toolbar on calling grid.reconfigure



babbarkrishan
16 Oct 2009, 12:56 AM
Hi,

I have following 2 methods. One for creating grid and another for reconfiguring the grid. Before reconfiguring grid is having 100 records and paging in toolbar is working fine. When I do reconfiguring, gird shows 10 records (which is fine as per my scenario) but paging toolbar does not change. Toolbar still shows the previous paging. Please let me know the solution as I am new to GXT.

private void createGrid(List<Store> storesList) {
PagingModelMemoryProxy proxy = new PagingModelMemoryProxy(storesList);

// loader
PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(
proxy);
loader.setRemoteSort(true);

ListStore<Store> store = new ListStore<Store>(loader);

final PagingToolBar toolBar = new PagingToolBar(50);
toolBar.bind(loader);

loader.load(0, 50);

grid = new Grid<Store>(store, getColumnModel());

grid.addListener(Events.CellDoubleClick, new Listener<GridEvent<Store>>() {
@Override
public void handleEvent(GridEvent<Store> be) {
ModelData model = grid.getStore().getAt(be.getRowIndex());
showPanel(model);
}
});

gridPanel.setBottomComponent(toolBar);
gridPanel.add(grid);
RootPanel.get().add(viewport);
}




private void reconfigureGrid(List<Store> storesList) {

PagingModelMemoryProxy proxy = new PagingModelMemoryProxy(storesList);

// loader
PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(
proxy);
loader.setRemoteSort(true);

ListStore<Store> store = new ListStore<Store>(loader);

final PagingToolBar toolBar = new PagingToolBar(50); // Not sure how to use it.
toolBar.bind(loader);

loader.load(0, 50);

grid.reconfigure(store, getColumnModel());

}

babbarkrishan
19 Oct 2009, 4:16 AM
I created a class level variable of ToolBar and call bind() with that variable in both methods.
toolBar.bind(loader); before grid.reconfigure(store, cm);

It works fine.


Thanks to admin team.

stnw
6 Jul 2010, 3:05 AM
Thanks you!