Complicated nested json loops to store with extjs -
i'm using geojson extracted naturalearthdata looks : 
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 : 
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
Post a Comment