PDA

View Full Version : Error in paging



aakashgarg
23 Nov 2015, 8:10 PM
I'm not getting the same number of records which I want in particular page.
I have a grid in which i want to use paging
Here is my grid
Ext.define('dc.view.sgx.PositionAccountGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.dc-sgx-positionaccountgrid',
requires: [ 'xgen.lang' ],
//_sqlQuery: 'OptionCover_query',
_queryDetails:'',
_repoQuery:'POSITIONACC',
viewConfig: {
preserveScrollOnRefresh: true
},
autoScroll: true,
store:'PositionAccountDetail',


initComponent: function () {
Ext.apply(this, {
width:800,
columns: [
......
],
bbar: {
xtype: 'pagingtoolbar',
store: 'PositionAccountDetail',
displayInfo: true,
displayMsg: 'Displaying {0} to {1} of {2}  records ',
emptyMsg: "No records to display ",

}

});
this.callParent(arguments);
}
});

Here is my store

Ext.define('dc.store.PositionAccountDetail', {
extend: 'Ext.data.Store',
alias: 'store.dc-positionaccountdetail',
requires: ['xgen.xci'],
autoSync: true,
model: 'dc.model.PositionAccountDetail',
pageSize: 10,

remoteSort: true,
groupers: [
{ property: 'ParticipantID', direction: 'ASC' }
],
sorters: [
{ property: 'RequestId', direction: 'DESC' }
],
proxy: Ext.create('xgen.data.Proxy', {
request: 'FilterMapping',
root: 'FilterMappingResponse.MsgData.Values',

error: function (resp, opt, respObj) {
// Intentionally do nothing as long as we can't check for a specific error
},

}),


});

joel.watson
24 Nov 2015, 6:10 AM
Hi--

Is your server returning the correct data? Can you share an example of the issue you're experiencing?

https://fiddle.sencha.com

Thanks!
Joel

aakashgarg
25 Nov 2015, 6:56 PM
Yup! data is correct the main issue is that It is returning total records on a single page/first page. Records are not divided according to the pagesize.
It is difficult to show a live example of my problem:((.

joel.watson
26 Nov 2015, 5:20 AM
Yup! data is correct the main issue is that It is returning total records on a single page/first page. Records are not divided according to the pagesize.
It is difficult to show a live example of my problem:((.

Hi--

With paging, the agreement between the request made by the store's proxy and the server is simply a "handshake"--the store is not going to do any manipulation of the data received from the server in order to enforce a particular number of records per page; it's merely going to consume what the server gives to it. So then, each response from the server for paged data should include the total size of the result set, as well as the individual page of data that corresponds to that particular request: e.g., if your page size is 25, the request for page 1 should include the first 25 records from the total set, page 2 the next 25, and so on.

Thanks!
Joel

aakashgarg
26 Nov 2015, 9:15 PM
I understood that what you want to explain but can you please tell me the code of how to do the same ??

sencha.santa
27 Nov 2015, 6:06 AM
I understood that what you want to explain but can you please tell me the code of how to do the same ??



When your proxy url is called, along with the URL 3 querystring parameters will be added &page=1&start=0&limit=15.


using this querystring parameters you have to manipulate your data and bring only the number of records required for a page.


For example:


if you are using DB query to pull data.


start=0
limit=20(your page size)
page=1(your page number)


endingrow=(page-1)*limit


select top (limit) from table1 where id not in (select top (endingrow) id from table1)