PDA

View Full Version : Paging toolbar last and next buttons are active with empty store..



manyu.tomar
6 Aug 2011, 12:05 AM
while using a paging toolbar with grid in extjs 4 , if u return a empty store,i.e., our store is returning an empty array , the next node and last page options are still active although ideally they should be disabled if grid is empty
please suggest any options to get rid of them .

thanks and regards

manyu.tomar
6 Aug 2011, 1:09 AM
after gone through the code and doing some study , i got that the page count is showing '0' on the paging toolbar when the store is empty , though it shold be at least '1' in all the conditions .plz suggest how to remove this bug .

manyu.tomar
6 Aug 2011, 1:40 AM
dont know the correct method , but i get rid of it by overriding the getpagedata() of paging toolbar .
the js code need to be included is

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)

};
}
});

eleftrik
6 Aug 2011, 6:53 AM
while using a paging toolbar with grid in extjs 4 , if u return a empty store,i.e., our store is returning an empty array , the next node and last page options are still active although ideally they should be disabled if grid is empty
please suggest any options to get rid of them .

thanks and regards

I have noticed the same problems.

manyu.tomar
7 Aug 2011, 11:35 PM
ya but i have get rid of this problem by overriding the above fn . actually the problem is ,its taking the total count of store to get the page size and with zero rows the page count is '0' , which is causing the problem in it .

Farish
3 Feb 2012, 2:48 AM
thanks manyu.tomar. the override seems to work fine.