如何在智能过滤器栏下使用多输入控件过滤表?

时间:2019-08-07 11:33:38

标签: sapui5 sapui5-smarttable

我正在尝试根据在智能过滤器栏中的多输入控件上选择的令牌用户来过滤列表报告中的数据。问题是,当前在批处理调用中,“和”运算符转到后端,而我想将条件应用为“或”。

$ filter = ObjectUUID_Level%20le%209%20and%20RootName%20eq%20%27Erik%27%27s%20Root%20%27%20and%20RootName%20eq%20%27French%20Cuisine%20%27%

下面是我尝试的代码:

onBeforeRebindTableExtension: function (oEvent) {

    var oBindingParams = oEvent.getParameter("bindingParams");

    var aFilter = [];
    oBindingParams.parameters = oBindingParams.parameters || {};
    var that = this;
    if (that.oTestInput.getTokens() != null && that.oTestInput.getTokens() != "") {
        if (that.oTestInput instanceof sap.m.MultiInput) {
                aFilter = this._getTokens(that.oTestInput, "RootName");;

                if (aFilter.length > 0) {
                    oBindingParams.filters.push.apply(oBindingParams.filters, aFilter);
                }
            }
        //oBindingParams.filters.push.apply(oBindingParams.filters, orFilter);
    }

},


_getTokens: function (oControl, sName) {
    var aToken, sToken=[], aFilters=[];
    aToken = oControl.getTokens();
    if (aToken) {
        for (var i = 0; i < aToken.length; i++) {
            aFilters.push(new sap.ui.model.Filter(sName, "EQ", aToken[i].getProperty("text")));

        }
    }
    //return new sap.ui.model.Filter([aFilters],false);
    return aFilters;
},

0 个答案:

没有答案