Reputation: 562
I have a combo box with a store getting data from a server via remote. My problem is that my pagination does not work. Here is a snippet of my code:
Ext.define('EmployeeModel', {
extend: 'Ext.data.Model',
fields: [
{name:'id', type:'int'},
{name:'fullname', type:'string'}
]
});
// remote store
var employeeStore= new Ext.data.Store(
{
model: 'EmployeeModel',
pageSize: 10,
proxy: {
url: '/schedule/home/EmployeeList',
params: {
'active_id': params
},
type: 'ajax',
autoLoad: true,
reader:
{
root: 'data',
totalProperty: 'total',
id: 'id',
type: 'json'
},
simpleSortMode: true
}
});
this.employeeBox = new Ext.form.ComboBox(
{
store: employeeStore,
displayField: 'fullname',
valueField: 'id',
typeAhead: false,
loadingText: 'Searching...',
triggerAction: 'all',
hiddenName: 'employee',
name: 'Employee Name',
fieldLabel: 'Employee',
selectOnFocus: true,
allowBlank: false,
anchor: '98%',
width: 370,
enableKeyEvents: true,
pageSize: true,
minListWidth: 220,
minChars: 2,
labelWidth: this.labelWidth,
resizable: false
});
I dont know what is lacking but as far as i have searched through the internet I copied and tested everything, still it does not work.
Upvotes: 2
Views: 5030
Reputation: 16150
If you have remote store, paging also should be remote. pageSize
is only parameter which is send to server, where you should handle paging. Beside pageSize
you will also see parameters like start
and limit
.
You can see example here: http://docs.sencha.com/ext-js/4-1/#!/example/form/forum-search.html
Check out requests in firebug or something similiar, you will see url like this: http://www.sencha.com/forum/topics-remote.php?_dc=1354611968514&query=form&page=2&start=10&limit=10&callback=Ext.data.JsonP.callback3
If you want to have paging on client side, you can create local store and preload data via custom AJAX request.
Upvotes: 1