PDA

View Full Version : Combo box with remote store not paging.



GMowery
12 Dec 2013, 7:38 AM
All,
I used the example at http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/form/forum-search.html. I edited it to the code below:


Ext.require([
'Ext.data.*',
'Ext.form.*'
]);


var sUrl = "\AJAXServlet?TAG_ACTION=SEARCH_FUNDREF_AJAX";

Ext.onReady(function(){

Ext.define("fundref", {
extend: 'Ext.data.Model',
proxy: {
type: 'ajax',
url : sUrl,
reader: {
type: 'json',
root: 'fundref',
totalProperty: 'totalCount'
}
},

fields: [
{name: 'id', mapping: 'id'},
{name: 'name', mapping: 'name'}
]
});

ds = Ext.create('Ext.data.Store', {
pageSize: 10,
autoLoad: false,
model: 'fundref'
});

panel = Ext.create('Ext.panel.Panel', {
renderTo: 'class-combo-search',
header:false,
width: 600,
bodyPadding: 10,
layout: 'anchor',

items: [{
xtype: 'combo',
store: ds,
displayField: 'name',
typeAhead: false,
hideLabel: true,
hideTrigger:true,
minChars: 3,
triggerAction: 'query',
anchor: '100%',
listConfig: {
loadingText: 'Searching...',
emptyText: 'No matching funders found.',

//Custom rendering template for each item
getInnerTpl: function() {
return '<span class="search-item">{name}</span>';

}
},
pageSize: 10
}, {
xtype: 'component',
style: 'margin-top:10px',
html: 'Live search requires a minimum of 4 characters.'
}]
});
});

Server side, I pick up the variables and supply the store via json with each page of data as requested.


Initial load works, displays the first 10 records.
When I page, the paging request is received and fulfilled by the server (confirmed with firebug that the ajax request sends a new set of data back via the response)
Using firebug, inspecting the datastore shows that its contents are still from page 1.
Unless I press the last page icon, which will actually load the very last record from the server properly (confirmed in firebug that the json returned was the 1 record).
Once I press the last page, the behavior is the same, and the display is now stuck on the one record in the datastore.

I imagine this is something simple, and I have yet to find it despite many attempts to set all kinds of parameters.

Any help would be appreciated.

Greg

GMowery
13 Dec 2013, 7:29 AM
This can be closed. The issue turned out to be that an earlier non-functioning version of the included js file was being cached along the network. Once I was able to actually get the above file to the browser, it started working. Thanks to anyone who looked at this. Greg

Gary Schlosberg
16 Dec 2013, 1:28 PM
Glad to hear you found the solution, and thanks for posting a follow-up.