cancel
Showing results for 
Search instead for 
Did you mean: 

OData Model.Read , Callback function not triggered

Former Member
0 Kudos

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");

} );

Accepted Solutions (1)

Accepted Solutions (1)

saurabh_vakil
Active Contributor
0 Kudos

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});
Former Member
0 Kudos

its working, thanks

Answers (2)

Answers (2)

maheshpalavalli
Active Contributor
0 Kudos

try the below code:

oModel.read(sPath, {

success: function(oEvent){

// you will get data in oEvent

}.bind(this)

});

Best Regards,
Mahesh

Former Member
0 Kudos

This works, thanks

former_member232384
Participant
0 Kudos

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

If a synchronous, a callback could not be called.

Former Member
0 Kudos

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