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?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With