-
18 Oct 2012 3:46 AM #1
Unanswered: How to load GeoJson file with sencha touch
Unanswered: How to load GeoJson file with sencha touch
I work for a project of mobile application with sencha touch, and I have a problem with my models to retreive informations. i will show you my model and my json file content
json file : ( i make it very simple just to test, i deleted the geometry line)
My model :Code:{ "type": "FeatureCollection", "features": [ { "properties": { "graphic": "img/restaurant.png", "Name": "Igor Tihonov", "Country":"Sweden", "City":"Gothenburg"} } ] }
Store :Code:Ext.regModel('Features', { hasMany: {model: 'Properties', name: 'properties'} }); Ext.regModel('Properties', { fields: ['graphic', 'Name', 'Country', 'City'], associations: [ {type: 'belongsTo', model: 'Features'} ] });
i have more than a week since i'm blocked, i wish that you could help me ! thank youCode:Ext.data.Store({ model: 'Features', proxy: { type: 'ajax', url : 'poi2.json', reader: { type: 'json', rootProperty: 'features' } }, autoLoad:true });
-
19 Oct 2012 5:37 AM #2Sencha - Community Support Team
- Join Date
- May 2012
- Location
- Istanbul
- Posts
- 1,331
- Vote Rating
- 77
- Answers
- 124
Hi hauos,
Add fields config into the Features model.
Code:Ext.regModel('Features', { fields:['features'], hasMany: {model: 'Properties', name: 'properties'} }); Ext.regModel('Properties', { fields: ['graphic', 'Name', 'Country', 'City'], associations: [ {type: 'belongsTo', model: 'Features'} ] });sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
22 Oct 2012 12:28 AM #3
thx for reply but nothing change dude !
i also dont understand why i have to add fields config into the Features model while i have no field into it ?


Reply With Quote