Reputation: 25
I want to filter table by value calculated with formatter. I calculate certain value with formatter and display it in table.
<ObjectStatus
text="{
path: 'values/',
formatter: '.formatter.calculate'}"/>
My question is if I can filter table by this calculated value and how? Do I need to add custom formating?
Filters are applied in controller:
let oFilter = new sap.ui.model.Filter(sPath, vOperator, vValue1);
aFilters.push(oFilter);
oBinding.filter(aFilters);
Upvotes: 0
Views: 1464
Reputation: 612
You can get the formatted value by accessing the control from the view and calling getText()
You'll need to assign an ID, first.
<ObjectStatus
id="objectStatus"
text="{
path: 'values/',
formatter: '.formatter.calculate'}"/>
Then in your controller:
var sFilterValue = this.getView().byId("objectStatus").getText();
var oFilter = new sap.ui.model.Filter(sPath, vOperator, sFilterValue);
oBinding.filter(oFilter);
Upvotes: 1