extjs - Sencha Touch 2 Nested list not displayed -
i'm trying display nestedlist json on hard disk, not displayed. doing wrong? no bugs in chrome. (chrome open applications / google \ chrome.app / contents / macos / google \ chrome - allow-file-access-from-files). blank screen without single error in console. if comment fullscreen: true, in mypanel.js clear nestedlist without data.
servlet.json
{ "stream":[{ "post_id": "1", "post_type": "text", "post_thumb": "bla1" }] } mypanel.js
ext.define('myapp.view.mypanel', { extend: 'ext.dataview.nestedlist', alias : 'widget.mypanel', config: { store : 'storere', title: 'nestedlist example', detailcard: { html: 'you can see detail information here!' } } }); storere.js
ext.define('myapp.store.storere', { extend: 'ext.data.treestore', config: { model: 'myapp.model.mymodel', defaultrootproperty : 'stream', proxy: { type: 'ajax', url: '.\/app\/servlet.json', reader: { type: 'json', rootproperty: 'stream' } } } }); mymodel.js
ext.define('myapp.model.mymodel', { extend: 'ext.data.model', config: { fields: [ {name:'post_id', type: 'string' }, {name:'post_type', type: 'string' }, {name:'post_thumb', type: 'string' } ] } }); theworld.js
ext.define('myapp.controller.theworld', { extend : 'ext.app.controller', config: { profile: ext.os.devicetype.tolowercase(), control: { 'mypanel': { activate: 'onactivate', leafitemtap: 'ondetaildisplay' } } }, onactivate: function() { console.log('main container active'); }, ondetaildisplay: function(nestedlist, list, index, target, record) { console.log('ondetaildisplay active'); var detailcard = nestedlist.getdetailcard(); }, onitemtap: function(view, list, index, target, record, event) { console.log('item tapped on data view'); }, init: function() { console.log('controller initialized'); }, }); upd:

you need change nestedlist config following.
config: { store : 'storere', //displayfield:'post_type', title: 'nestedlist example', listconfig : { itemtpl: '{post_type}' }, detailcard: { html: 'you can see detail information here!' } } there displayfield config of nestedlist can specify field used set title , item text . default set text can specify 1 of model field. if overriding getitemtexttpl or gettitletexttpl, config ignored.
plus there's listconfig config option available can mention itemtpl config. json having multiple fields image , text nodes assume want show too.
so can have listconfig following :
listconfig: { itemtpl: '<div><img src="{post_thumb}">{post_type}</div>' }, reasons of list not getting displayed might be-
- store not loaded proper data. ( make sure inspect network tab in chrome see if
servlet.jsonpresent. displayfieldand/orlistconfignot mentioned.
Comments
Post a Comment