Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

How to get the Count of records in a Collection

$
0
0

Hi,

 

I am using a chart (makit) control in my SAP UI5 view and binding it to a oData Model using the following code.

 

oChartX.bindAggregation("rows", "/DepartmentCollection");

 

I am also using Filters to filter the data in Service. This chart is interactive and on Click of a series, it calls the service with another filter param and shows the updated data.The code i used is below:

 

oChartX.attachEvent("doubletap",function(eventObj)

{

vSelectedCategory = eventObj.oSource.getSelectedCategory();

 

var oFilter2 = new sap.ui.model.Filter("Department_ID",sap.ui.model.FilterOperator.EQ,vSelectedCategory);

oChartX.bindAggregation("rows", "/DepartmentCollection");

oChartX.getBinding("rows").filter(oFilter2);

}

 

My problem is : At one point of time, service does not return any data ( 0 Records ) based on provided filters but still this chart displays the previous set of data. It confuses user that the navigation didn't happen correctly and he/she taps on the series (chart) again and again.

I want to know the count of records retruned by service call. So that if this count is Zero then i can show some alert to user saying No Further Navigation Possible.

 

Please Help.


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>