PDA

View Full Version : paging and filtering in a combobox with local proxy



markpele
14 Jun 2009, 2:18 AM
I have a local store with a large number of records.
I want to have a combobox that gives real time filtering when the user types in it
but I want to present max 10 results in the combo.

The forum-search example show how to do it with mode = remote and a pagingToolbar.
Is it possible to achieve the same result with a local proxy?

Thanks

markpele
14 Jun 2009, 4:13 AM
I've tried to use the pagingMemoryProxy in the combos.js example:

// simple array store
/*var store = new Ext.data.ArrayStore({
fields: ['abbr', 'state', 'nick'],
data : Ext.exampledata.states // from states.js
});*/

var store = new Ext.data.Store({
proxy: new Ext.data.PagingMemoryProxy(Ext.exampledata.states),
reader: new Ext.data.ArrayReader({}, ['abbr', 'state', 'nick'])
});


var combo = new Ext.form.ComboBox({
pageSize: 5,
store: store,
displayField:'state',
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
applyTo: 'local-states'
});

But the combo is empty

tdteti_
23 Oct 2009, 12:38 AM
Hi,
after creates the store (since to it is in 'local' mode), you must load it manually:

store.load();{

params:{
start:0,
limit:5,
}
});

...I am doing the same type of combo but my problem is the live-search. That search is only working over the current page to which the combo is showing. It means, if I try to search a value to which is missing on the current page (although it exist dataset) that is not found. I am seeing the 'store' object is only loaded with the current page and this is the reason the search only works there... I would need to solve it. Could you help me, please? Do you know how can I solve it?

Thanks in advance ;)!

Condor
23 Oct 2009, 12:41 AM
You need to set mode:'remote' when using a PagingMemoryProxy.

ps. I would recommend using my PagingStore user extension (http://www.extjs.com/forum/showthread.php?t=71532) instead (can work with mode:'local').