PDA

View Full Version : [UNKNOWN][3.0.3] Wrong first page size in combobox with store+overridden param names



plotyan
15 Dec 2009, 6:17 AM
Combobox makes query with default paging parameters names. It may be wrong when using store with overrided parameters names.

In my case I use a store, configured with:

paramNames: { start = "Skip", limit = "Take", sort = "Property", dir = "Direction" }

I think it's better to use store params names for queries, especially because combobox always uses stores.

Condor
15 Dec 2009, 6:35 AM
This has already been fixed in Ext 3.0.0.

Only Ext 2.x specifies separate paramNames in Ext.PagingToolbar.

plotyan
15 Dec 2009, 6:58 AM
Hm... I use 3.0.3... And this is part of ext-all-debug.js (from line #56608):



// private
getParams : function(q){
var p = {};
//p[this.queryParam] = q;
if(this.pageSize){
p.start = 0;
p.limit = this.pageSize;
}
return p;
},


and this is loading data from Combobox.doQuery(..):


this.store.load({
params: this.getParams(q)
});


Or I'm wrong and this code is irrelevant for data query?

plotyan
15 Dec 2009, 7:02 AM
My problem with combo is described in this thread (http://www.extjs.com/forum/showthread.php?t=87752). Please, take a minute to look.

Condor
15 Dec 2009, 7:26 AM
OK, I only looked at Store and PagingToolbar, but this is indeed a bug in ComboBox.

Quick fix:

Ext.override(Ext.form.ComboBox, {
getParams : function(q){
var p = {}, pn = this.store.paramNames;
if(this.pageSize){
p[pn.start] = 0;
p[pn.limit] = this.pageSize;
}
return p;
}
});
but a more correct fix would be:

Ext.override(Ext.form.ComboBox, {
getParams : function(q){
var p = {};
if(this.pageTb){
var pn = this.pageTb.getParams();
p[pn.start] = 0;
p[pn.limit] = this.pageTb.pageSize;
}
return p;
}
});

plotyan
15 Dec 2009, 10:26 PM
Yeah, it solves the problem, thanks!