Skip to content

Instantly share code, notes, and snippets.

@kbuzyk
Created September 29, 2011 10:32
Show Gist options
  • Save kbuzyk/1250487 to your computer and use it in GitHub Desktop.
Save kbuzyk/1250487 to your computer and use it in GitHub Desktop.
how about to add condition that checks current page and total pages count?
//Insight.view.PagingGrid
storeListener : function(store) {
var toolbar = this.down('pagingtoolbar');
if ( toolbar ) {
var newVisible = (store.getTotalCount() > store.pageSize);
var oldVisible = toolbar.isVisible();
toolbar.setVisible(newVisible);
store.currentPage = (Math.ceil(store.getTotalCount()/store.pageSize) >= store.currentPage) ? store.currentPage : Math.ceil(store.getTotalCount()/store.pageSize);
if (oldVisible != newVisible) {
this.doComponentLayout();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment