-
3 Apr 2011 1:08 PM #1
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:
I'd appreciate any insight.Code:[ ['North America', [ ['United States', ['Alabama', 'Alaska', 'Arizona', ...] ], ['Canada', ['Alberta', 'British Columbia', 'Manitoba', ...] ], ... ], ['Central America', ['Mexico', ['Aguascalientes', 'Baja California', 'Baja California Sur', ...] ], ... ], ... ]
Thanks,
Kniget
-
7 Apr 2011 7:16 AM #2
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:
As far as I know, the reader is configured in the store definition, not in the model. Am I right?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" }] }
Is it possible to haved nested arrays with json objects?
Thanks!
-
9 Apr 2011 2:17 AM #3
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:
That still leaves my original question open: is it possible to consume nested arrays?Code:hasMany: {model: '[name of model for a single array record]', name: '[name of array in the JSON object]', storeConfig: {reader: {type: 'array'}}}
Kniget
Similar Threads
-
Decode data with ArrayReader without using store or grid
By wuschba in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 15 Feb 2011, 7:30 AM -
Ext.data.ArrayReader.readRecords have a bug when mapping 'prop1.propNext'
By skzr.org in forum Ext 3.x: Help & DiscussionReplies: 4Last Post: 16 Apr 2010, 4:19 AM -
How type of data must I put in my store? (array doesn't works, ArrayReader either)
By samax in forum Ext 3.x: Help & DiscussionReplies: 4Last Post: 16 Jun 2009, 1:11 AM -
[2.0.2/2.1] issue with config options in Ext.data.ArrayReader
By sergiy in forum Ext 2.x: BugsReplies: 0Last Post: 22 Apr 2008, 5:53 AM


Reply With Quote