PDA

View Full Version : multi param find?



moegal
21 Dec 2010, 5:07 AM
Is there a built in function to find a value in a store when using more then one fieldname?



var rec = store.find('lookupid',theLinkedid) AND ???


Or do I need to look thru the store and query first to narrow down list?

Thanks, Marty

Condor
21 Dec 2010, 5:19 AM
Use findBy() with your own function.

moegal
21 Dec 2010, 5:53 AM
thanks, I'll take a look at findBy

Marty

frankthetank
21 Dec 2010, 2:42 PM
Here a simple example, where I needed a filter on 3 columns using an OR.



Ext.getCmp('my_grid_id_here').getStore().filterBy(function(record, id){

pattern = new RegExp(Ext.getCmp('my_textfield').getValue(), 'gi');

if( pattern.test(record.get('column1')) || pattern.test(record.get('column2')) || pattern.test(record.get('column3')) ){
return true;
}
});

moegal
21 Dec 2010, 4:29 PM
Frank,

Thanks. What does your functiuon return?

Marty

frankthetank
21 Dec 2010, 4:33 PM
It returns true or false depending on the row.
True when it goes in the IF, so it keep it on the grid. If it returns false, then the row will not show.