PDA

View Full Version : how to make ComboBox always have Paging Toolbar



stupidext
11 Aug 2009, 7:32 PM
How can i set Combobox.mode 'remote',and Combobox always have a PagingToolbar?
Whether i manually load combobox's store or not.




//combo's store
var moduleStore = new Ext.data.Store({
url : "../service.sa",
baseParams : {
"service" : "RecPermission",
"operator" : "getModuleGridList"
},
reader : new Ext.data.XmlReader({
totalRecords : "totalCounts",
record : "item"
}, [{
name : "ModuleId"
}, {
name : "ModuleName"
}])
});
//when this store loaded here, combo will not show a PagingToolbar!
moduleStore.load({
params : {
start : 0,
limit : 6
}
});

{
xtype : "combo",
fieldLabel : 'choose',
minListWidth : 240,
width : 200,
blankText : 'choose',
mode : 'remote',
pageSize : 6,
minChars : 0,//for input query param
displayField : 'ModuleName',
triggerAction : 'all',//when click the trigger,query all data
queryParam : 'modulename',
valueField : 'ModuleId',
store : moduleStore
}

17 Aug 2009, 3:16 AM
seriously... nice name...

Condor
17 Aug 2009, 3:54 AM
1. You load the store with limit:20, but you set the combobox to pageSize:6?
2. Don't load the store if you set mode:'remote'!
3. Why would you want to override the renderer?

stupidext
18 Aug 2009, 2:29 AM
1. You load the store with limit:20, but you set the combobox to pageSize:6?
2. Don't load the store if you set mode:'remote'!
3. Why would you want to override the renderer?


1. pageSize:6
i copied that code otherwhere...thank u 4 reminding me^^
2. in ext2.0, when i set mode 'remote',i can load that store,and i can see a paging toolbar too.
3. i'd like to see a paging toolbar under that combo list,when i load that store...
if not, lost of work should be done to fit this ext3.0's ComboBox

stupidext
18 Aug 2009, 2:33 AM
seriously... nice name...

i :))ed when i saw this 'nice name' secondly...

easy to remenber,isn't it?

Condor
18 Aug 2009, 2:38 AM
You don't need to load the store of a mode:'remote' combobox. The combobox will load the store itself when required.

Try:

var moduleStore = new Ext.data.Store({
url: "../service.sa",
//autoLoad: true, <- do not load store
baseParams: {
"service": "RecPermission",
"operator": "getModuleGridList"
},
reader: new Ext.data.XmlReader({
totalRecords: "totalCounts",
record: "item"
}, [{
name: "ModuleId"
}, {
name: "ModuleName"
}])
});
/* do not load store
moduleStore.load({
params: {
start: 0,
limit: 20
}
});*/

{
xtype: "combo",
fieldLabel: 'choose',
minListWidth: 240,
width: 200,
blankText: 'choose',
listEmptyText/*emptyText*/: 'choose' // <- there is no emptyText option
mode: 'remote',
pageSize: 6,
//minChars: 0, <- does nothing when triggerAction: 'all'
displayField: 'ModuleName',
triggerAction: 'all',
queryParam: 'modulename', <- does nothing when triggerAction: 'all'
valueField: 'ModuleId',
store: moduleStore//,
//inputType: 'text' <- already the default
}

stupidext
18 Aug 2009, 6:29 PM
there is a situation:
1. combobox might be loaded with a query.i have no idea if store is loaded.
2. query param changed, i must (re)load that combobox.(manually)

see my first post,i already know manually loading can cause this problem.
i try to find a easier way,i only want that PagingToolbar back.
no other (easier) solution?

like i said: override some kind of 'render' things?
so that i set mode 'remote', combobox has a pagingtoolbar.




You don't need to load the store of a mode:'remote' combobox. The combobox will load the store itself when required.

Try:

var moduleStore = new Ext.data.Store({
url: "../service.sa",
//autoLoad: true, <- do not load store
baseParams: {
"service": "RecPermission",
"operator": "getModuleGridList"
},
reader: new Ext.data.XmlReader({
totalRecords: "totalCounts",
record: "item"
}, [{
name: "ModuleId"
}, {
name: "ModuleName"
}])
});
/* do not load store
moduleStore.load({
params: {
start: 0,
limit: 20
}
});*/

{
xtype: "combo",
fieldLabel: 'choose',
minListWidth: 240,
width: 200,
blankText: 'choose',
listEmptyText/*emptyText*/: 'choose' // <- there is no emptyText option
mode: 'remote',
pageSize: 6,
//minChars: 0, <- does nothing when triggerAction: 'all'
displayField: 'ModuleName',
triggerAction: 'all',
queryParam: 'modulename', <- does nothing when triggerAction: 'all'
valueField: 'ModuleId',
store: moduleStore//,
//inputType: 'text' <- already the default
}