on 2018 May 03 4:12 PM
Hi,
I am implementing a cart function into my UI5 app to collect a collection of items for further processing. My cart works fine as a feature in my Master-Detail app.
One thing I'd like to add is a counter next to the cart button to inform the user how many items currently are in the cart. My Gateway service happily returns the correct value when I use the $count option. So far, so good.
What I'm struggling with is the
re 1: I decided to retrieve the counter within the onBeforeRendering method. Although I am happy to listen to any advice here.
re 2: I am using the code below.
onBeforeRendering: function() {
var oCountModel = new sap.ui.model.odata.v2.ODataModel("<oData GW service>");
oCountModel.read("/cartSet/$count", {
method: "GET",
async:false,
success: function(data) {
var response = (JSON.stringify(data));
},
error: function() {
}
});
},
The above code call the service synchronous, but doesn't return the service response ("data is undefined"). However, I can see the response later in the Network tab in Chrome.
So basically, the service works and is called, but for some reason I can't seem to get the resulting response.
Any ideas/hints where I am going wrong with this?
Request clarification before answering.
Have you tried transaction /n/iwfnd/traces to find out how the http request looks like that is received by the SAP Gateway system?
Regards,
Andre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
12 | |
9 | |
8 | |
8 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.