on 03-21-2017 3:28 PM
Hello,
In a Sapui5 application, I would like to display total of an OData EntitySet. I can see in Network calls that $count is retrieved in a $batch call :
Header : GET MyEntitySet/$count
Response : 7163
How can I retrieve this value in the controller? I would like to avoid another call of $count.
Thanks for your help.
Cheers,
Sev
assuming the request went via the binding to the table, you need to register for the update finished event for the table or list and in the event handler method, use the below code. check in the debugging once to make sure the code is fine
oEvent.getParameter("total").
You might also have to check if the items length is final by using the below code.
if( this.getView().byId("List").getBinding("items").isLengthFinal() ){ // because this event will be triggered 2 times as far as i remember
var scount = oEvent.getParameter("total");
}
Best Regards,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your answer. I was using this method before, but unfortunately I don't use a sap.m.Table anymore but a sap.ui.table.Table. This component doesn't have updatefinished event.
Any other way to get total value?
Best regards,
Sev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to attach a event handler for the event: requestCompleted of odata v2 model. you might get the response over there.
Best Regards,
Mahesh
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.