my output ![my output][1]
i have been trying parse nested json url cannot parse , have looked available link: link1 link2 link3 link4
this previous question
my json is
({ "accountinfo": { "expire_date": "2014-07-02 08:01:09", "subscribe_date": "2013-07-02 08:01:09", "time_remain": " 355 days 20 hours 47 minutes", "status": "not expired" }, "status": "true", "message": "todays word", "data": [ { "name": "abacus", "author": "admin", "word_id": "2", "category": "education", "definitions": [ { "rating": "green", "defintion": "replace \"my pc\" asdf edited", "def_id": "53", "example": null, "author": "admin" }, { "rating": "this definition not rated yet.", "defintion": "my new definition of word abacus", "def_id": "7", "example": null, "author": "admin" }, { "rating": "this definition not rated yet.", "defintion": "lorem ipsum dolor sit amet, consectetur adipisicing elit. ea, tempore labore veritatis maxime beatae est incidunt consectetur adipisci dolore reiciendis. nostrum fugiat cumque beatae voluptatum.", "def_id": "45", "example": null, "author": "admin" }, { "rating": "this definition not rated yet.", "defintion": "this sub def rep abacus' \"venture capitalist\"", "def_id": "31", "example": null, "author": "admin" } ], "is_favourite": "yes" } ] })
my model are
ext.define('sencha.model.menu', { extend: 'ext.data.model', config: { fields: [ 'name', 'author', 'word_id', 'category', 'data.definitions.definition' ], belongsto: "sencha.model.contact" } }); ext.define('sencha.model.contact', { extend: 'ext.data.model', requires: ['sencha.model.menu'], config: { fields: [ {name: 'status', mapping: 'status'}, {name: 'message', mapping: 'message'}, {name:'data', mapping: 'data'}, {name: 'definitions', mapping: 'definitions.defintion'}, {name: 'ratings', mapping: 'definitions.rating'}, /* {name: 'definition', mapping: 'definitions'}*/ /*{name: 'definition', mapping: 'data.definition.final_rating'}, json data parsing favourite page , today's word 65%*/ ], } });
my store
ext.define('sencha.store.contacts', { extend: 'ext.data.store', config: { model: 'sencha.model.contact', autoload: true, //sorters: 'name', grouper: { groupfn: function(record) { return record.get('name')[0]; } } } });
my view
ext.define("sencha.view.main", { extend: 'ext.tab.panel', requires: ['ext.titlebar', 'sencha.view.contacts'], config: { tabbarposition: 'bottom', items: [ { title: 'contacts', iconcls: 'home', xtype: 'contacts' } ] } }); ![i have been able upto this][7] ext.define('sencha.view.contacts', { extend: 'ext.list', xtype: 'contacts', config: { title: 'stores', cls: 'x-contacts', store: 'contacts', itemtpl: [ '<div>', '<h2><b>hello</b></h2>', '<tpl for="data">', '<div> - {name}</div>', '<div> - {author}</div>', '<div> - {word_id}</div>', '<div> - {category}</div>', '<div> - {definitions}</div>', '</tpl>', '</div>' ].join('') } });
my output supposed ![enter image description here][8]
i'm not sure trying achieve, rebuilt application locally , able screen:
i think major change made json:
[ { "accountinfo": { "expire_date": "2014-07-02 08:01:09", "subscribe_date": "2013-07-02 08:01:09", "time_remain": " 355 days 20 hours 47 minutes", "status": "not expired" }, "status": "true", "message": "todays word", "data": [ { "name": "abacus", "author": "admin", "word_id": "2", "category": "education", "definitions": [ { "rating": "green", "defintion": "replace \"my pc\" asdf edited", "def_id": "53", "example": null, "author": "admin" }, { "rating": "this definition not rated yet.", "defintion": "my new definition of word abacus", "def_id": "7", "example": null, "author": "admin" }, { "rating": "this definition not rated yet.", "defintion": "lorem ipsum dolor sit amet, consectetur adipisicing elit. ea, tempore labore veritatis maxime beatae est incidunt consectetur adipisci dolore reiciendis. nostrum fugiat cumque beatae voluptatum.", "def_id": "45", "example": null, "author": "admin" }, { "rating": "this definition not rated yet.", "defintion": "this sub def rep abacus' \"venture capitalist\"", "def_id": "31", "example": null, "author": "admin" } ], "is_favourite": "yes" } ] } ]
give shot , let me know if still have errors, or if looking else.
good luck, brad
Comments
Post a Comment