PDA

View Full Version : How to add "All" value to a remote combobox ?



goofy
27 Sep 2010, 7:15 AM
Hi,
i looking for a way to add a value to first item of a remote combobox.

I have try:



listeners:{
load: function(Store){
var MyRecordType = Ext.data.Record.create(['id', 'name']);
var myrec = new MyRecordType({"id":"0", "name":"All"});
Store.insert(0,myrec);
}
}


This work but i get "All" each time i type something in combo for searching.

I looking for any ideas please ?

thanks

Animal
27 Sep 2010, 7:28 AM
It's doing what you are asking it to:

Inserting "All" at the top on load.

What are you complaining about?

goofy
27 Sep 2010, 7:51 AM
It do the same thing when you search on it even if "All" don't match the search

plalx
27 Sep 2010, 12:57 PM
Well, if combobox items are filtered server-side, the All option will always be visible since you are adding the option locally, after the store has been loaded...

goofy
27 Sep 2010, 3:22 PM
Anyway find a solution myself :


load: function(store, records, options){
if(Ext.isEmpty(options.params.query)){
var MyRecordType = Ext.data.Record.create(['id', 'name']);
var myrec = new MyRecordType({"id":"0", "name":"Tous"});
store.insert(0,myrec);
}
}