mercredi 30 avril 2014

Pagination not working.

Hello,

I am trying to get a list of records from database and display them in my search results grid. But for some reason the pagination is not working. It is displaying all the records in the first page and the pagination tool bar shows Page 0 of 0, with previous and next buttons getting disabled. I know I am missing something in my code and I tried different ways but of no result.

My code:


this.dockedItems = [

{

xtype: 'pagingtoolbar',

dock:'bottom',

layout: 'hbox',

items: [

{

store: myEmailStore,

displayInfo: true,

displayMsg: 'Displaying emails {0} - {1} of {2}',

emptyMsg: "No emails to display"

},]


}];

initComponent: function() {

var myEmailStore = Ext.create('First.store.Emails', {

autoDestroy: true

});

this.items = [

{

xtype: 'firstgridpanel',

cls:'gridList',

store: emailStore,

itemId: 'myEmailSearchResultsGrid',

columns: [

{

header: 'Email ID',

width: 100,

dataIndex: 'emailId',

sortable: true

},

{

header: "Subject",

width: 170,

dataIndex: 'subject'

},

{

header: "Received Date",

width: 170,

dataIndex: 'receivedDtFormatted',

sortable: true

},

] }

];


Then I am having

Ext.define('First.store.Emails', {

extend: 'Ext.data.Store',


requires: ['First.model.Email', 'First.EHelper', 'Ext.data.proxy.Ajax'],


model: 'First.model.Email',

autoLoad: false,

storeId: 'emails',

pageSize: 20,


proxy: {

type: 'ajax',

method: 'POST',

url : First.EHelper.getBaseUrl() + 'email/queryMymails',

enablePaging: true,

reader: {

type: 'json',

totalProperty: 'total',

root: 'data',

successProperty: 'success'

},

listeners: {

exception: function(proxy, response, operation){

Ext.MessageBox.show({

title: 'REMOTE EXCEPTION',

msg: operation.error,

icon: Ext.MessageBox.ERROR,

buttons: Ext.Msg.OK

});

}

}

}

});


On the Server Side, I am setting everything like the pagesize,list, etc in a Jason object and returning. On the server side I am getting all the correct values. Not sure what's happening once I return the Json object.

Any help/suggestions?..





Aucun commentaire:

Enregistrer un commentaire