PDA

View Full Version : all values of a field in the store



raj_plays
9 Mar 2011, 11:25 AM
Hi,
How can I get an array of all values of a particular field in a store?
I tried
var arr = Store.query('name', new RegExp('*'));
but it gives an error.
Please help.

fay
9 Mar 2011, 11:46 AM
For unique field values use:



var arr = Store.collect('name');


For all values:



var arr = [];
store.each(function(r)
{
arr[arr.length] = r.get('name');
});

raj_plays
9 Mar 2011, 12:00 PM
Thank you, fay.