Results 1 to 2 of 2

Thread: Get data from JsonStore

  1. #1
    Sencha User
    Join Date
    Feb 2010
    Location
    Seattle, USA
    Posts
    19

    Default Get data from JsonStore

    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:

    Code:
    {
        "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?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    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.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •