Skip to Content
0

OData Model.Read , Callback function not triggered

Mar 21, 2017 at 06:10 PM

366

avatar image

I'm using ODataModel.read to access data from a service,

Following is the code :

var text = "800003886";

var sPath="/OverviewDeliveryDetailSet(IDelivery='"+text+"')";

var oModel = this.getView().getModel();

oModel.read(sPath , null , null , false ,

function(oData, oResponse){

console.log("msg"); },

function(error){

console.log("msg");

} );

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
saurabh vakil Mar 22, 2017 at 09:15 AM
0

Try writing the read function as below:

var fnSuccess = function(oData, oResponse) {
console.log("msg");
};

var fnError =  function(error) {
console.log("msg");
};

oModel.read(sPath , {success: fnSuccess, error: fnError});
Show 1 Share
10 |10000 characters needed characters left characters exceeded

its working, thanks

0
Seungchul Yang Mar 22, 2017 at 01:29 AM
0

If a 4th argument value false is for a async, it should be true.

If a synchronous, a callback could not be called.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Have tried using both true and false in the 4th argument , but the issue persists

0
Mahesh kumar palavalli Mar 22, 2017 at 09:04 AM
0

try the below code:

oModel.read(sPath, {

success: function(oEvent){

// you will get data in oEvent

}.bind(this)

});

Best Regards,
Mahesh

Show 1 Share
10 |10000 characters needed characters left characters exceeded

This works, thanks

0