PDA

View Full Version : Paging Plugin : Problem with Load more button (Help)



Bassem
29 Jun 2011, 6:11 AM
Hey Sencha People,

I'm having a problem using the paging plugin, my page size is 25 and i got 32 persons to show, so it gives me 25 and when i click on load more, it gives a blank page when the XHR content of the query on Safari gives the right content to display.

it has to be about this line : thisList.getStore().loadPage();

This is the Hole source code of the list.


Ext.regModel('User', {
fields: [{
name: 'kwPerFirstName',
type: 'string'
},{
name: 'kwPerLastName',
type: 'string'
}
]
});

Employes = Ext.extend(Ext.Panel, {
constructor: function(customConfig) {

var store = new Ext.data.Store({
model: 'User',
sorters: 'kwPerFirstName',
listeners: {
beforeload: {
fn: function(dataProxy, params) {
delete params.sorters;
var field = Ext.getCmp('person-sf');
var query = '';
if (field && field.rendered) {
query = field.getValue();
}

if (query !== '') {
this.proxy.extraParams.query = query;
this.proxy.extraParams.search = ' [Form] CONTAINS fPerson AND ([kwPerFirstname] CONTAINS *{query}* OR [kwPerLastname] CONTAINS *{query}* )';
} else {
this.proxy.extraParams.search = ' [Form] = fPerson';
}
this.proxy.extraParams.fields = '["kwPerFirstName","kwPerLastname"]';

}
}

},
proxy: {
type: 'ajax',
method: 'POST',
actionMethods: {
read: 'POST'
},
headers: {
'Content-Type': 'application/json; charset=UTF-8'
},
url : $G.org + '/(akwWebSearch)?openAgent',
reader: {
type: 'json',
root: 'data'
}
},
autoLoad: false
});

var searchF = new Ext.form.Search({
id: 'person-sf',
name: 'sf',
placeHolder: 'rechercher',
listeners: {
action: {
fn: function(field, event) {
this.load();
},
scope: store
}
}
});

config = Ext.apply({
title: 'Org',
layout: 'fit',
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [searchF]
}],
items:[new Ext.List({
id: 'plist',
scroll: 'vertical',
plugins: [new Ext.plugins.ListPagingPlugin({
loadMoreText: 'load more...',
autoPaging: false
})],
itemTpl : '{kwPerFirstName} {kwPerLastName}',
store: store,
listeners: {
beforerender: {
fn: function(thisList) {
thisList.getStore().loadPage();

}
}
}
})]
}, customConfig);

Employes.superclass.constructor.call(this, config);
}
}
);

Anyone able to help me.

I need to make the loadmore button show the following page, then i'll be able to fix the bug of the loadmore button useless display.


Sorry if my english is horrible

Regards