PDA

View Full Version : Get data from JsonStore



gurpreet.saini
25 Nov 2011, 12:14 AM
I am loading a JsonStore with autoLoad and on callback i need to get the data out of the store. e.g. my response is like:



{
"chartData": [
{"xyz":1,"abc":0.0,"def":0.0},
{"xyz":11,"abc":0.1,"def":0.01},
{"xyz":21,"abc":0.2,"def":0.02},
{"xyz":31,"abc":0.3,"def":0.03},
{"xyz":41,"abc":0.4,"def":0.04},
{"xyz":51,"abc":0.5,"def":0.05},
{"xyz":61,"abc":0.6,"def":0.06}
]
}


can i get "xyz" from this store as an array like [1, 11, 21, 31, 41, 51, 61] without iterating?

mitchellsimoens
25 Nov 2011, 8:51 AM
No matter if there was a simple method to execute on the store to do this, it would have to iterate through it's data to create that Array. But there isn't a simple method so you will have to do a store.each() and create your Array. Unless you have thousands of records, it will be pretty fast.