Hello,
I have created the following combobox in an xml view:
<ComboBoxid="categoryComboBox"items="{path:'categoryModel>/category', filters: { path: 'Context', operator: 'EQ', value1: 'CASE' } }"selectedKey="{newCase>/CATEGORY_ID}">
<core:Itemid="categoryComboBoxItem"key="{categoryModel>CategoryId}"text="{path:'categoryModel>', formatter:'tl.ibp.ct.alert.monitor.utils.Utils.formatCategory'}"/>
</ComboBox>
now I need to create the same, but in the controller, I don't know how to apply the filter filters: { path: 'Context', operator: 'EQ', value1: 'CASE' } .
var categoryModel = this.getView().getModel("categoryModel");
var categoryComboBox = new sap.m.ComboBox("ComboBoxID");
categoryComboBox.setModel(categoryModel);
var oItemTemplate1 = new sap.ui.core.ListItem();
oItemTemplate1.bindProperty("text", "categoryModel>CategoryId");
categoryComboBox.bindItems("categoryModel>/category", oItemTemplate1);
I have tried the following:
var categoryItemsBinding = categoryComboBox.bindItems("categoryModel>/category", oItemTemplate1);
categoryItemsBinding.filter( new sap.ui.model.Filter({ path : "Context", operator : sap.ui.model.FilterOperator.EQ, value1 : "CASE" }));
but it didn't work.
any suggestions?
thanks.