1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    4
    Vote Rating
    0
    kniget is on a distinguished road

      0  

    Default nested data with ArrayReader

    nested data with ArrayReader


    Hi all,

    ExtJS 4 certainly makes it easy to read nested data into associated data stores/models. However, is it at all possible to read nested data using ArrayReader only? Note, I am referring to a data structure wholly composed of nested arrays - no objects - so as to conserve the bandwidth taken by repeating JSON object titles.

    An example of such data would be:

    Code:
    [
        ['North America', [  
            ['United States',
                ['Alabama', 'Alaska', 'Arizona', ...]
            ],
            ['Canada',
                ['Alberta', 'British Columbia', 'Manitoba', ...]
            ], ...
        ],
        ['Central America', 
            ['Mexico',
                ['Aguascalientes', 'Baja California', 'Baja California Sur', ...]
            ], ...
        ], ...
    ]
    I'd appreciate any insight.

    Thanks,
    Kniget

  2. #2
    Ext JS Premium Member
    Join Date
    Mar 2010
    Location
    Barcelona
    Posts
    33
    Vote Rating
    1
    deister is on a distinguished road

      0  

    Default


    I am also in interested in nested ArrayReader!!

    Moreover, is it possible to nest a json objects with arrays?
    Ideally, my store should consume objects like:

    Code:
    resultset : {
    
        "sqlinfo" : {
             "maxrows":-1,
             "total":1,
             "sql_sort":"",
             "sql_user":"xxx",
             "sql_dbms":"xxx",
             "sql_dbms_name":"xxx Postgres",
             "sql_engine":"postgres"
        },
        "rowset":[
            [4596.0,  490.0],
            [2596.4,  435.7],
            [596.0,    450.8],
            [1296.0,  390.9,]
        ],
        "metadata" : [{
            "columnName"  : "col1",
            "columnLabel" : "col1",
            "columnDisplaySize":40,
            "columnType":12,
            "columnTypeName":"numeric"        
        },{
            "columnName"  : "col2",
            "columnLabel" : "col2",
            "columnDisplaySize":40,
            "columnType":12,
            "columnTypeName":"numeric"        
        }]
    }
    As far as I know, the reader is configured in the store definition, not in the model. Am I right?

    Is it possible to haved nested arrays with json objects?

    Thanks!

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    4
    Vote Rating
    0
    kniget is on a distinguished road

      0  

    Default consuming array from a JSON object

    consuming array from a JSON object


    Deister,

    You can consume an array from a JSON object by defining (in the store or model intended to receive the JSON object) a hasMany association to the array, and providing the association with a storeConfig to an ArrayReader, like so:

    Code:
    hasMany: {model: '[name of model for a single array record]', name: '[name of array in the JSON object]', storeConfig: {reader: {type: 'array'}}}
    That still leaves my original question open: is it possible to consume nested arrays?

    Kniget

Similar Threads

  1. Decode data with ArrayReader without using store or grid
    By wuschba in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 15 Feb 2011, 7:30 AM
  2. Ext.data.ArrayReader.readRecords have a bug when mapping 'prop1.propNext'
    By skzr.org in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 16 Apr 2010, 4:19 AM
  3. Replies: 4
    Last Post: 16 Jun 2009, 1:11 AM
  4. Replies: 0
    Last Post: 22 Apr 2008, 5:53 AM

Thread Participants: 1

Tags for this Thread