breaking Service promise/deferred chain by passing parameter

44 views
Skip to first unread message

Mic1

unread,
May 22, 2014, 4:12:19 PM5/22/14
to def...@googlegroups.com
Service:

loadDashList: function() {
       
var deferred;

        deferred
= Ext.create("Deft.promise.Deferred");


       
this.getDashListStore().load( {
            scope
: this,
            callback
: function(records, operation, success) {
                console
.log('flow: what is success? ', success); // displays
               
if (success) {
                    console
.log('flow: DataVisionService.loadDashList.success'); // displays
                   
return deferred.resolve(records);
               
} else {
                   
return deferred.reject("Error loading loadDashList");
               
}
           
}
       
});
       
return deferred.promise;
   
}


This works correctly and both messages are displayed, but I need to configure the proxy operation at runtime with:

loadDashList: function() {
       
var deferred;

        deferred
= Ext.create("Deft.promise.Deferred");


       
var operation1 = new Ext.data.Operation({
            action
: 'read',
           
params: {
                start
: 0,
                limit
: 1000,
                procNm
: 'sel_dshbrd_json2',
                srchStrng
: 1,
                connId
: 'AW'
           
}

       
});

       
this.getDashListStore().load(operation1 {
            scope
: this,
            callback
: function(records, operation, success) {
                console
.log('flow: what is success? ', success); // does not display
               
if (success) {
                    console
.log('flow: DataVisionService.loadDashList.success'); // does not display
                   
return deferred.resolve(records);
               
} else {
                   
return deferred.reject("Error loading loadDashList");
               
}
           
}
       
});
       
return deferred.promise;
   
}

This loads the store correctly i.e. the params get to php etc ..... but ..... no messages displayed ... so somehow I think I am messing up the Deft flow by adding the extra parameter? Appreciate some insight into what I am doing incorrectly. tia.

Brian Kotek

unread,
May 22, 2014, 5:01:16 PM5/22/14
to deftjs
The Store load() method doesn't accept this parameter, so I'll assume you're overriding load() with your own implementation?

Also, you have no comma between the first parameter (operation1) and the second parameter (the options object).


--
Deft JS home page: http://deftjs.org/
Wiki: https://github.com/deftjs/DeftJS/wiki
For rules and tips on asking questions on the Deft JS mailing list: https://github.com/deftjs/DeftJS/wiki/Asking-Questions-on-the-Mailing-List
---
You received this message because you are subscribed to the Google Groups "Deft JS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deftjs+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/deftjs/81716d3a-ac4c-4fab-82f9-eb3be47c51d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages