PDA

View Full Version : Ext.data.Store Not Populated with scripttag proxy result



dmillasich
2 Feb 2011, 3:38 PM
Hi - I've got a script that's making a server request for a json response. The request is returned by the server and I can see it in the Javascript callback function - however, the data never makes it into the data store.

There are no errors reported after the server has satisfied the request. Is there something required by the javascript callback function beyond what I've been able to glean from the documentation?

Thanks for any help.




Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function(){
/* set up model */
Ext.regModel('Movie', {
fields: [{name:'title'}, {name:'year'}]
});
/* define store */
var myStore = new Ext.data.Store({
model: 'Movie',
proxy: {
type: 'scripttag',
url: 'http://my.server.com/channel/getmovielist/callback/getResponse',
reader: {
type: 'json',
root: 'movies'
},
},
autoLoad: true
});
/* call me when you get back in town */
getResponse = function(response) {
Ext.Msg.alert('What', 'Now?');
};

var toolbar = new Ext.Toolbar({
dock: 'top',
title: 'Toolbar',
items: [{
text: 'button',
handler: function() {
Ext.Msg.alert('clickity', 'click');
}
}]
});
new Ext.Panel({
fullscreen: true,
dockedItems: [toolbar]
});
}
});

dmillasich
2 Feb 2011, 8:31 PM
To get the data into the model it was a matter of calling the loadData method with the json result returned by the server.



getResponse = function(response) {
myStore.loadData(response, false);
};

dmillasich
3 Feb 2011, 6:33 AM
the forum site is acting mighty weird this morning. it's complained that "my token has expired", lost and then found a post that i'd submitted last night - as well as displaying a few php errors.

i noticed that the sencha site in general has been redesigned - perhaps this is a ripple effect of that update. in order to get myself back into a stable state, i cleared the sencha cookies from my cache.

so far, so good.