Complicated nested json loops to store with extjs -


i'm using geojson extracted naturalearthdata looks : enter image description here

all want catch name of each feature in order display them in grid (live search grid.. btw efficient 2000 names?) can't access name root property. tried loop features

ext.define('myapp.store.places', {     extend: 'ext.data.store',     alias: 'store.places',     requires : ['myapp.model.placesmodel',                 'myapp.view.main.mainmodel'],     id: 'places',     model: 'myapp.model.placesmodel',     autoload: true,     proxy: {         type: 'ajax',         url : '/resources/data/coord.json',         reader: {             type: 'json',             transform: {                 fn: function(data) {                     for(var = 0; < data.features.length -1; i++){                         names_places.push(data.features[i].properties.name);                     }                     debugger;                     return names_places;                 },                 scope:             }         }     } }); 

but debugger sent me result don't understand : enter image description here

especially when array looks : enter image description here

what way catch name? return has json?

you can use mapping attribute on fields array in model definition map correct attribute in json field.

you set rootproperty features reader.

then in fields array similar this

fields: [     { name: 'mycustomfield', mapping: 'properties.name' } ] 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -