PDA

View Full Version : Pagination problem with ComboBox in local mode



Suresh
6 Apr 2010, 5:02 AM
Hi,

I have problem with combo box pagination in local mode. I am using SimplePagingStore as a store to the combo box.

Problem : when combo box drop down trigger, the pagination tool bar showing as total pages are 1 even there are n number of pages and the next button is disabled.

When refresh the paging tool bar, the pagination works properly, it shows total number of pages and next buttons enabled.

Here is the code:




Ext.onReady(function(){

var dataArr = [];
for(i=1;i<=20;i++){
dataArr.push([i, 'Agent'+i]);
}

var dataStore = new Ext.ux.data.SimplePagingStore({
fields: ['id', 'name'],
data: dataArr
});


var mycombo = new Ext.form.ComboBox({
id:'mycmb'
,renderTo:'combo1'
,width:200
,hideOnSelect:false
,maxHeight:200
,store:dataStore
,triggerAction:'all'
,valueField:'id'
,displayField:'name'
,mode:'local'
,pageSize:5
});

dataStore.load({params: {start: 0, limit: 5}});

});



Can anyone please point what is wrong in this.

Thanks,
Suresh

Condor
6 Apr 2010, 5:21 AM
With local data you need to specify lastOptions (see PagingStore thread (http://www.extjs.com/forum/showthread.php?t=71532)).

Suresh
6 Apr 2010, 8:26 AM
I have verified with that option as well, but no luck.



var dataStore = new Ext.ux.data.SimplePagingStore({
fields: ['id', 'name'],
data: dataArr,
lastOptions: {params: {start: 0, limit: 5}}
});

Suresh
6 Apr 2010, 8:47 AM
I am using 2.x Ext.ux.data.PagingStore [v0.4].

Suresh
6 Apr 2010, 10:43 PM
Here I am attaching the image, this explains my problem.

C:\Documents and Settings\suresh\Desktop\dropdown.JPG


I am sure, I am doing some thing wrong, please correct me.

Thanks,
Suresh

Condor
6 Apr 2010, 11:57 PM
I tested ext-3.2.0 and your combobox displays correctly.

Which Ext version are you using?

ps. You don't need to load the store if you specify 'data'.

dataStore.load({params: {start: 0, limit: 5}});

Suresh
7 Apr 2010, 1:21 AM
Thanks for the reply Condor.
I am using ext-2.0.2 because this is LGPL.

Condor
7 Apr 2010, 2:04 AM
I'll have to check ext-2.0.2...

ps. Aren't you bothered by the fact that ext-2.0.2 doesn't correctly support IE8, Firefox3 and Safari4?

Suresh
7 Apr 2010, 2:44 AM
Solved it by adding lazyInit:false. On page load the pagination works.




Ext.onReady(function(){

dataArr = [];
for(i=1;i<=20;i++){
dataArr.push([i, 'Agent'+i]);
}

dataStore = new Ext.ux.data.SimplePagingStore({
fields: ['id', 'name'],
data: dataArr,
lastOptions: {params: {start: 0, limit: 5}}
});

mycombo = new Ext.form.ComboBox({
id:'mycmb'
,renderTo:'combo1'
,width:200
,hideOnSelect:false
,maxHeight:200
,store:dataStore
,triggerAction:'all'
,valueField:'id'
,displayField:'name'
,mode:'local'
,pageSize:5
,resizable: true
,lazyInit:false
});
dataStore.load({params: {start: 0, limit: 5}});
});




We are using extjs in very limited places of my project. I will push for upgrading to ext-3.2.

Thanks Condor for your help.

Thanks,
Suresh