E
egarcia
Guest
Hello Bidhan, The key to calling invoke operations is to access the JSDO instance associated with the datasource. Your reference to the JSDO would look like "this.scope._$ds.CustomerDS.transport.jsdo" or "this.customerDS.transport.jsdo" if you have saved the reference in the view factory. Please notice that the sample code saves a reference to the model. This works fine if you are working with a form, however, if you are using a grid or a grid + form, the model instance may change and the saved reference would not point to the current model. Once that you have the JSDO instance, you would use the invoke() method: this.scope._$ds.CustomerDS.transport.jsdo.invoke("GetCreditInfo", {}); You can handle the response from the invoke operation either via a subscribe or a promise. (You can also use both, i.e., use a promise and also subscribe to the AffterInvoke event.) If you prefer to use a subscribe, you can specify it in the onShow in the view-factory.js using the following code: this.scope._$ds.CustomerDS.transport.jsdo.subscribe("AfterInvoke", "GetCreditInfo", this.onAfterInvoke); If you prefer to use a promise, you would call the invoke operation and specify a function for done and for fail: var promise = this.scope._$ds.CustomerDS.transport.jsdo.invoke("GetCreditInfo", {}); promise.done(function (jsdo, success, request) { console.log("Success: " + JSON.stringify(request.response)); }); promise.fail(function (jsdo, success, request) { console.log("Error: "); }); Please let me know if you need more info. Cheers, Edsel
Continue reading...
Continue reading...