json - Google spreadsheed API with Sencha Touch Ext.List -
i using sencha touch 2.1 build mobile app. trying load google spreadsheet datasource list.
i have made google spreadsheet public can find @ link:
https://docs.google.com/spreadsheet/pub?key=0ahw0xtl9j2badhlwre1qce1wddvla2drddbxntjbv0e&output=html
however not able working.
here code have far:
the model
ext.define('myapp.model.infolist', { extend: 'ext.data.model', config: { fields: [ 'title', 'description', 'icon' ], idproperty: '_id' } });
the store
ext.define('myapp.store.infolist', { extend : 'ext.data.store', config : { model : 'myapp.model.infolist', proxy: { type: 'jsonp', url : 'https://spreadsheets.google.com/feeds/list/0ahw0xtl9j2badhlwre1qce1wddvla2drddbxntjbv0e/od6/public/basic?alt=json-in-script', reader: { type: 'json', root: 'feed.entry' } } } });
the view
ext.define('myapp.view.home.infolist', { extend : 'ext.list', xtype : 'infolistview', disableselection: true, config : { title : 'info list', itemtpl: [ '<div class="iteminfo">', '<div class="icondiv">', '<img src="{icon}" class="icon"/>', '</div>', '<div class="descriptiondiv">', '<div class="title">{title}</div>', '<div class="description">{description}</div>', '</div>', '<div class="disclosurediv">', '<img src="images/infolistdisclosure.png" class="iconimage"/>', '</div>', '<div class="clear"></div>', '</div>', ].join(''), store : 'infolist' } });
the list empty. , if use jsonp instead of json in proxy app stop running.
is there way see responce proxy in alert? or indications might problem appreciated
ps: building application on ibm worklight, using sencha codings. i'm not sure if affects anything
thank you
the attributes in json response lowercase 'title' & 'content' whereas model field names have first letter in uppercase 'title' & 'description'. there no field 'description' in json, 'content' , also'title' data in '$t' attribute.
i'd suggest dump , @ parsed json object in console understand how render attribute correctly.
one more thing, instead of using:
use this:
to columns attributes of entry
object. in case can define model this:
ext.define('myapp.model.infolist', { extend: 'ext.data.model', config: { fields: [ {name : 'id',type : 'string', mapping:'id.$t'}, {name : 'title',type : 'string', mapping:'gsx$title.$t'}, {name : 'description',type : 'string', mapping:'gsx$description.$t'}, {name : 'icon',type : 'string', mapping:'gsx$icon.$t'} ], idproperty: 'id' } });
Comments
Post a Comment