Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extjs store find all

Documentation of Ext.data.Store find method says:

Finds the index of the first matching Record in this store by a specific field value.

My question is how can I find indexes of all matching records in this store?

like image 288
Sebastian Avatar asked May 09 '12 07:05

Sebastian


3 Answers

I think the best function met your needs is queryBy() because it returns array of matched Records.

You still can use each() to check if the Model matches the criteria then add them to an array. But this function is more appropriate to traversing all Records in the store, not just for "filtering" data.

like image 190
U and me Avatar answered Nov 11 '22 18:11

U and me


Extjs store have few methods which return first matched record by a specific field value. To get all filtered records you have to use each function && than match or filter the desired records.

like image 28
Gopal Saini Avatar answered Nov 11 '22 19:11

Gopal Saini


If you are using ExtJS 3.x, assuming you have your data store referenced by store

Ext.pluck(store.filter('field', 'value'), 'id');

returns an array containing the indexes of the matching records.

like image 1
malteo Avatar answered Nov 11 '22 18:11

malteo