Skip to Content
avatar image
Former Member

OData Model.Read , Callback function not triggered

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

} );

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 22, 2017 at 09:15 AM

    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});
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 22, 2017 at 01:29 AM

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

    If a synchronous, a callback could not be called.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 22, 2017 at 09:04 AM

    try the below code:

    oModel.read(sPath, {

    success: function(oEvent){

    // you will get data in oEvent

    }.bind(this)

    });

    Best Regards,
    Mahesh

    Add comment
    10|10000 characters needed characters exceeded