PDA

View Full Version : How to covert a working ExtJS datastore to Sencha Touch model?



locutusUT
30 Jul 2010, 3:17 PM
Hello,

I have a working ExtJS example that I am trying to port to SenchaTouch using the model approach described here (http://us1.campaign-archive.com/?u=fb30e9d0e8ab5e66a19398a14&id=57d8ec8b01&e=0cd68bbb0a). For my use case, it's basically a scripttagproxy that pull's back json data that I would like to have stored. When I try using this code I get "Uncaught TypeError: Object #<an Object> has no method 'setModel'".

Any ideas?

TIA!



Ext.regModel('Die', {
fields: [
{name: 'dieId'},
{name: 'dieName'},
{name: 'dieType'},
{name: 'dieFoundry'},
{name: 'dieRev'}
]
});
var list = new Ext.List ( {
title: 'My Dies',
store: new Ext.data.Store ({
autoLoad: true,
model: 'Die',
proxy: {
type: 'scripttag',
url: 'http://myserver.com/solr-oasis/select?',
callbackParam: 'json.wrf',
extraParams: {
q: 'fred',
version:'2.2',
indent:'on',
start:0,
rows:10,
qt:'dismax_hw',
wt:'json',
'json.nl':'arrarr'
},
reader: {
type: 'json',
root: 'response.docs',
totalProperty: 'response.numFound'
}
}
}),
tpl: ['<tpl for=".">', '<div>',
'<h2>{dieId}</h2>',
'<p>{dieName}</p><strong></strong>','<p>{dieFoundry}</p>',
'</div>', '</tpl>'].join(''),
emptyText: '<p style="padding: 10px">No dies found matching that search</p>'
});

locutusUT
30 Jul 2010, 4:20 PM
Just saw there is a new release for Sencha Touch (0.92). Using that version allowed this to work as expected.

evant
30 Jul 2010, 10:01 PM
There's been a few changes to the data package to fix up some bugs in 0.92.

gauravbdubey
29 Sep 2011, 11:05 PM
Thanks for the Example