var genericFeaturesStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'getRecords.do'}),
reader: new Ext.data.ArrayReader({}, [
{ name: 'title' },
{ name: 'records', convert : convertRecords}
]),
...
});
proxy: new Ext.data.HttpProxy({url: 'getRecords.do'}),
reader: new Ext.data.ArrayReader({}, [
{ name: 'title' },
{ name: 'records', convert : convertRecords}
]),
...
});
The converter looks like this:
var convertRecords = function(v, record) {
for (var i = 0; i < v.length; i++) {
v[i] = new Record(
v[i].title,
v[i].description,
v[i].serviceType,
v[i].serviceURLs,
v[i].keywords);
}
return v;
};
The problem I had was that the convertRecords() seemed to begin execution but not complete, although the application was not stuck but appeared as if convertRecords() had returned.
The solution, which should help for any generic Store loading (or not loading) problem:
genericFeaturesStore.on({
'load': {
fn: function(store, records, options) {
alert("load");
},
scope: this
},
'loadexception': {
fn: function(obj, options, response, e) {
alert("error: "+e);
},
scope: this
}
});
This allowed me to see that it was throwing an error because it couldn't find the serviceType for one of the many records.
0 comments:
Post a Comment