on 2021 Aug 04 1:46 PM
I have a Smart-table tied to a smart-filterbar, and I am displaying multiple-views in the table, (implemented by icon filters).
I want to show a count for each tab. But the smart table only retrieves the count of the current tab. I tried a trick to submit a manual odata $count with the other filters in onBeforeRebindTable method. But I don't want it to perform counts if the criteria has not changed. I only want to re-count when user clicks Go in the smart filterbar.

I see screenshots in SAP documentation of List Reports with multiple-views that automatically display counts of all tabs. How do they do that? and why can't we do the same thing for Smart tables? List reports are based on smart-filter and smart-tables afterall.
Any help would be appreciated.

Request clarification before answering.
Hello,
The List Report is a template with lot of build-in logic. Just because you use Smart Controls does not mean that all the logic of a Fiori Element will be implemented.
For your point, you can use the event updateFinished in your binding and then find the different count. But you can also send 3 request $count with different filters.
For exemple :
<mvc:View
controllerName="view.Root"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
>
<List id="list"
headerText="Categories"
items="{/Categories}"
growing="true"
growingThreshold="4"
growingScrollToLoad="true"
updateFinished=".countProducts"
>
<ObjectListItem
title="{description}"
numberUnit="Products"
/>
</List>
</mvc:View>
Controller.js
countProducts: function(e){
var m = sap.ui.getCore().getModel();
var items = this.byId("list").getItems();
for (var item_index = 0; item_index < items.length; item_index++) {
var item = items[item_index];
(function(_item) {
$.get(
m.sServiceUrl + _item.getBindingContextPath() + "/Categorias/$count",
function(count) {
_item.setNumber(count);
}
);
})(item);
}
}
source: https://stackoverflow.com/a/30244325
Regards,
Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Multiple views for a List Report table in Fiori Elements | SAP Blogs
This blog might help anyone else facing the same question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use showCounts : true in the variant settings.
This is found in the sap.ui.generic.app section in the manifest.json.
"quickVariantSelectionX": {
"enableAutoBinding": true,
"showCounts": true,
"variants": {
"Header": {
"key": "Header"
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 14 | |
| 8 | |
| 6 | |
| 6 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.