
Originally Posted by
brprashanth
Hi,
Im trying to implenting pagination. I have a webservice which returns "Total Count" and records.
From client side, I have json store which pulls data from this service.
I have ext grid which binds to this store. Im not been able to implement paging. Ext version used 4.0
// Create store
var myStore = new Ext.data.JsonStore({
pageSize: 5,
// Load data at once
//autoLoad: true,
autoLoad: {params: {start: 0, limit: 5, regionId: 1}},
// Override default http proxy settings
proxy: new Ext.data.HttpProxy({
type: 'ajax',
url: 'WebService1.asmx/GetNewPeopleForPaging',
headers: {
'Content-type': 'application/json'
},
reader: {
type: 'json',
root: 'd.Peoples',
totalProperty: 'Count',
successProperty: 'success'
},
method: 'POST'
}),
fields: ['Id', 'Name', 'Address', 'Type'] // Simple definition of column
});
Ext.define('USERS.view.Grid', {
extend: 'Ext.ux.LiveSearchGridPanel',
alias: 'widget.userlist',
title: 'All Users',
store: 'Users',
columns: [{
header: 'Id',
dataIndex: 'Id',
flex: 1
}, {
header: 'Name',
dataIndex: 'Name',
flex: 1
}, {
header: 'Address',
dataIndex: 'Address',
flex: 1
}, {
header: 'Type',
dataIndex: 'Type',
flex: 1
}]
});
var grid = new Ext.grid.Panel({
// Set store
store: myStore,
remoteSort : true,
columns: [{
header: 'Id',
dataIndex: 'Id',
flex: 1,
hidden: true,
hideable: false
}, {
header: 'Name',
dataIndex: 'Name',
flex: 1
}, {
header: 'Address',
dataIndex: 'Address',
flex: 1
}, {
header: 'Type',
dataIndex: 'Type',
flex: 1
}],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: myStore,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
items:[
'-', {
}],
}),
// Render grid to dom element with id set to panel
renderTo: 'district_grid'
});