【问题标题】:additional filters on binding with existing aggregation与现有聚合绑定的附加过滤器
【发布时间】:2018-11-15 03:22:56
【问题描述】:

我有一个值帮助对话框,其中的行绑定如下:

        // set data
        oValueHelpDialogTable.bindAggregation("rows", {
            path: "/ProductSet",
            filters: aFilters
        });

使用应用于 oData 源的过滤器。

现在我想通过过滤栏设置额外的过滤器:

var bFilters = [];
bFilters.push(new sap.ui.model.Filter(aKeys[0], sap.ui.model.FilterOperator.Contains, oSearchField.getValue()));
var oTableBinding = oValueHelpDialogTable.getBinding();
oTableBinding.filter(bFilters);

但由于某种原因,未应用过滤器。如果我从 bindAggregation 调用中删除 aFilters,则其他过滤器将起作用。

【问题讨论】:

  • 您正在更换过滤器,而不是添加。

标签: javascript filter sapui5 aggregation


【解决方案1】:

作为 I.B.N.说,你正在更换你的过滤器,没有添加一个新的......

我的建议是将过滤器的当前状态保存在控制器的全局变量中或“视图模型”中

然后在推送新过滤器并再次设置它们之前检索它们。

如果你使用视图模型,它会是这样的

//To save the current filters
this.getView().getModel("myViewModelName").setProperty("/currentFilters", aFilters)

//To retrieve the current filters
var bFilters = this.getView().getModel("myViewModelName").getProperty("/currentFilters")
bFilters.push(new sap.ui.model.Filter(aKeys[0], sap.ui.model.FilterOperator.Contains, oSearchField.getValue()));
var oTableBinding = oValueHelpDialogTable.getBinding();
oTableBinding.filter(bFilters);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-20
    • 1970-01-01
    • 2014-02-19
    • 1970-01-01
    • 2015-09-17
    • 2014-02-02
    • 2017-03-09
    • 1970-01-01
    相关资源
    最近更新 更多