cancel
Showing results for 
Search instead for 
Did you mean: 

Objects passed in Callback functions of Model

SandipAgarwalla
Active Contributor
0 Kudos

hi

What are the object passed in the model's callback functions e.g. attachRequestCompleted / attachRequestFailed...I am trying to get the response code/status, the data etc on a model call

Does it send the status & the XHR object ?

var dataModel = new sap.ui.model.json.JSONModel();

dataModel.attachRequestCompleted(function(data,textStatus,jqXHR){

});

dataModel.attachRequestFailed(function(object){

               <<<>>>>

})

Thanks

Sandip

Accepted Solutions (1)

Accepted Solutions (1)

former_member182650
Contributor
0 Kudos

Hi Sandip,

May be are the same as jQuery Ajax Call:

jQuery.ajax() | jQuery API Documentation

  • jqXHR.done(function( data, textStatus, jqXHR ) {});An alternative construct to the success callback option, the .done() method replaces the deprecated jqXHR.success() method. Refer to deferred.done() for implementation details.
  • jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});An alternative construct to the error callback option, the .fail() method replaces the deprecated .error() method. Refer to deferred.fail() for implementation details.
  • jqXHR.always(function( data|jqXHR, textStatus, jqXHR|errorThrown ) { });An alternative construct to the complete callback option, the .always() method replaces the deprecated .complete()method.

Kind regards

SandipAgarwalla
Active Contributor
0 Kudos

Hi Angel

I tried the same too, looks like apart from data, nothing is available and the data contains the entire response string, including the code/actual data object and everything

The other two, textStaus/jqXHR comes undefined.. I wasnt sure if I was doing it right

try

alert(JSON.stringify(data));

Thanks

Sandip

Answers (0)