PDA

View Full Version : ExtJs 4 Grid pagination bar



AtulDawkhare
24 May 2012, 4:30 AM
Hi ,

I am using Extjs 4.0.7. I have Grid with Paging Toolbar.

I am facing problem , when there are no records in the Grid , Still the paging toolbar show 1 of 0 records and Next image get's enabled.

I want to show disabled all the images .i.e. Next , Previous etc when there are no records in the Grid.

Please suggest me how can I do this?

35580

Farish
24 May 2012, 4:34 AM
You can use this override. I also found it on the forums:


Ext.override(Ext.toolbar.Paging, {
getPageData : function(){
var store = this.store,
totalCount = store.getTotalCount();
if(totalCount === 0)
totalCount = 1 ;

return {
total : totalCount,
currentPage : store.currentPage,
pageCount: Math.ceil(totalCount / store.pageSize),
fromRecord: ((store.currentPage - 1) * store.pageSize) + 1,
toRecord: Math.min(store.currentPage * store.pageSize, totalCount)
};
}
});

scottmartin
24 May 2012, 10:27 AM
Please note that this has been corrected in 4.1 if you can upgrade.

Scott.

AtulDawkhare
24 May 2012, 9:03 PM
Thanks for the reply.
Let me try it out