Skip to Content
author's profile photo Former Member
Former Member

ODataModel attachRequestCompleted

Hi there,

I am trying to bind to the attachRequestCompleted event against an ODataModel and the event does not seem to be fired in the case of a create. It appears to fire in the case of a read but not create. Can anybody tell me if this is a known bug and is there any way around it? The code I am using is below.

var oModel = new sap.ui.model.odata.ODataModel(app.getServiceUrlById("someId"));
  oModel.attachRequestSent(function(){
     console.error("Request Sent");
  });

  oModel.attachRequestCompleted(function(){
     console.error("Request Completed");
});

Thanks.

Curtis

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Sep 25, 2015 at 05:06 PM

    you are right, _loadData is the only place where they fire RequestSent

    for create you can pass as part of second parameter

    mParameters.success

    mParameters.error

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 25, 2015 at 05:08 PM

    but fireRequestCompleted is fired pretty much for all kind of requests

    Add a comment
    10|10000 characters needed characters exceeded

    • Just redefine and odatamodel, it is not as hard as it seems

      like

      jQuery.sap.declare("util.model.MyODataModel");

      jQuery.sap.require("sap.ui.model.odata.ODataModel");

      jQuery.sap.require("sap.ui.model.odata.ODataListBinding");

      jQuery.sap.require("util.model.CacheableODataListBinding");

      sap.ui.model.odata.ODataModel.extend("util.model.MyODataModel", {

      constructor : function(sServiceUrl, bJSON, sUser, sPassword, mHeaders, bTokenHandling, bWithCredentials, bLoadMetadataAsync) {

      sap.ui.model.odata.ODataModel.apply(this, arguments);

      }

      });

      util.model.PSAODataModel.prototype.bindList = function(sPath, oContext, aSorters, aFilters, mParameters, isCachable) {

      return (sPath == "/CustomerSet" ? new util.model.CacheableODataListBinding(this, sPath, oContext, aSorters, aFilters, mParameters)

      : new sap.ui.model.odata.ODataListBinding(this, sPath, oContext, aSorters, aFilters, mParameters));

      };

  • Posted on Sep 09, 2016 at 06:22 AM

    Hi,

    The method attachRequestCompleted method not supported by V4 odata model. That's the reason why you could not fire that event. For more detail, you can see from:

    http://help.sap.com/saphelp_snc700_ehp04/helpdata/de/12/32241b99d7437ba3614698d53dfa4b/content.htm

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.