PDA

View Full Version : [SOLVED] DirectStore not Firing Load Event



kouphax
10 Jun 2009, 1:39 AM
Hello,

I recently attempted to switch from a JsonStore to a DirectStore (for experimental reasons) and I can;t get the load event to fire anymore. The code for the store is below which is almost identical to the old JsonStore. Am I doing something wrong?


var store = new Ext.data.DirectStore({
idProperty: 'ID',
fields: ['ID', 'Title', 'Samples'],
directFn:SamplesActions.getCatalog,
listeners: {
load : function(s, rec) {
debugger;
s.each(function(r) { tpl.append('sample-menu', r.data); });
setTimeout(function() {
Ext.get('loading').remove();
Ext.fly('loading-mask').fadeOut({remove: true});
}, 250);
}
}
});

The direct function is being called and returning a result but the event just doesn't fire (Ext 3.0 RC2).

Any help would be appreciated.

James.

stever
10 Jun 2009, 12:35 PM
Try this:


var store = new Ext.data.DirectStore({
idProperty: 'ID',
fields: ['ID', 'Title', 'Samples'],
directFn:SamplesActions.getCatalog,
paramsAsHash:false,
root:'',
listeners: {
load : function(s, rec) {
debugger;
s.each(function(r) { tpl.append('sample-menu', r.data); });
setTimeout(function() {
Ext.get('loading').remove();
Ext.fly('loading-mask').fadeOut({remove: true});
}, 250);
}
}
});

kouphax
11 Jun 2009, 12:06 AM
Brilliant. This works as expected. Thanks.