PDA

View Full Version : Numbering on Paging toolbar incorrect; any suggestion on fixing?



psubedi2010
20 Oct 2010, 12:33 PM
Please refer to attached image. The page count comes up incorrect.

Thank you

steffenk
20 Oct 2010, 1:38 PM
looks like wrong code ... what do you expect from a pic with wrong numbers?

plalx
20 Oct 2010, 6:58 PM
Posting code would help...

psubedi2010
22 Oct 2010, 9:56 AM
code for paging toolbar:


var bbar = new Ext.PagingToolbar(
{
pageSize: myPageSize,
store: searchProviders,
displayInfo: true,
displayMsg: 'Displaying {0} - {1} of {2}',
emptyMsg: "No Matching records found",
paramNames : {start: 'startIndex', limit: 'chunkSize'},
doLoad :
function(start){
var o = getSearchParams();
o.start = start;
o.startIndex = start;
o.limit = this.pageSize;
o.chunkSize = this.pageSize;
if(this.fireEvent('beforechange', this, o) !== false){
this.store.load({params:o});
}
this.updateInfo();
},
moveFirst :
function(){
this.doLoad(0);
},
movePrevious :
function(){
this.doLoad(Math.max(0, parseInt(this.cursor) - parseInt(this.pageSize) ));
},
moveNext :
function(){
this.doLoad(parseInt(this.cursor) + parseInt(this.pageSize) );
},
moveLast :
function(){
var total = this.store.getTotalCount(),
extra = total % parseInt(this.pageSize);
this.doLoad(extra ? (total - extra) : total - parseInt(this.pageSize));
},
doRefresh :
function(){
this.doLoad(parseInt(this.cursor));
},
items: [
'-',
'Per Page: ',
combo,
{
xtype:'button',
text:'Search Again',
pressed:true,
handler:
function() {
goToPage(SEARCH_ENTRY);
}
}
]
}
);
combo.on('select',
function(combo, record) {
bbar.pageSize = parseInt(record.get('id'));
bbar.chunkSize = parseInt(record.get('id'));
bbar.doLoad(parseInt(bbar.cursor));
},
this);

plalx
22 Oct 2010, 10:39 AM
Why are you overriding all paging toolbar functions?
Are you sure that you returned the total of records that matched the query correctly, you have to return the whole total, not just the total of records returned by the server. E.g. if i have 100 records matching my query, but I display only 1 - 50, the server should still return 100 as total.

psubedi2010
23 Oct 2010, 8:56 AM
correct; overriding was done put in parseInt for counts so that display would be correct; I understand there's better way to accomplish this with a separate function. I suppose this is irrerelevant to the fact the total page count is incorrect.

Condor
25 Oct 2010, 1:56 AM
1. You've renamed start and limit in the PagingToolbar. Did you also rename them in the store?

2. Does your server return the total number of records and is totalProperty configured correctly in the store.

3. You are overriding the PagingToolbar, but I don't see why you feel you need to...