1. #1
    Sencha User kouphax's Avatar
    Join Date
    Mar 2007
    Location
    Belfast
    Posts
    58
    Vote Rating
    0
    kouphax is on a distinguished road

      0  

    Default [SOLVED] DirectStore not Firing Load Event

    [SOLVED] DirectStore not Firing Load Event


    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?

    Code:
    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.

  2. #2
    Ext JS Premium Member stever's Avatar
    Join Date
    Mar 2007
    Posts
    1,407
    Vote Rating
    6
    stever will become famous soon enough stever will become famous soon enough

      0  

    Default


    Try this:

    Code:
    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);
                                }
                            }
                        });

  3. #3
    Sencha User kouphax's Avatar
    Join Date
    Mar 2007
    Location
    Belfast
    Posts
    58
    Vote Rating
    0
    kouphax is on a distinguished road

      0  

    Default


    Brilliant. This works as expected. Thanks.

Thread Participants: 1