如何解决FilterBar的SAP UI5绑定问题
我需要根据服务响应动态创建我的过滤器栏。
控制-sap.ui.comp.filterbar
版本-1.71.4-我认为版本不是问题。我也在1.81.1(最新的Webide)中尝试过
fb:control中的组合框未绑定项目聚合。不确定在这里缺少什么。
查看
<mvc:View controllerName="com.TestIconTabBinding.controller.View1" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m"
xmlns:core="sap.ui.core" xmlns:fb="sap.ui.comp.filterbar">
<App id="app">
<pages>
<Page id="page" title="{i18n>title}" showHeader="false" floatingFooter="true">
<content>
<fb:FilterBar filterGroupItems="{oMasterModel>/allFilters}" advancedMode="true" search="onFilterBarWithSuggestionsSearch">
<fb:filterGroupItems>
<fb:FilterGroupItem groupName="__$INTERNAL$" name="{oMasterModel>label}" label="{oMasterModel>label}" labelTooltip="{oMasterModel>label}"
visibleInFilterBar="true">
<fb:control>
<ComboBox items="{oMasterModel>suggestionItems}">
<!-- <ComboBox items="{oMasterModel>/allFilters/0/suggestionItems}"> this works for testing purposes but I dont need it like this-->
<core:Item key="{oMasterModel>obj}" text="{oMasterModel>obj}"/>
</ComboBox>
</fb:control>
</fb:FilterGroupItem>
</fb:filterGroupItems>
</fb:FilterBar>
</content>
</Page>
</pages>
</App>
</mvc:View>
控制器
sap.ui.define([
"sap/ui/core/mvc/Controller","sap/ui/model/json/JSONModel"
],function (Controller,JSONModel) {
"use strict";
return Controller.extend("com.TestIconTabBinding.controller.View1",{
onInit: function () {
var oMasterModel = new JSONModel();
this.getView().setModel(oMasterModel,"oMasterModel");
oMasterModel.refresh(true);
this.loadDataSet();
},loadDataSet: function () {
var oMasterModel = this.getView().getModel("oMasterModel");
var oDataSet = {
"allFilters": [{
"label": "Filter1","suggestionItems": [{
"obj": "001"
},{
"obj": "002"
}]
},{
"label": "Filter2","suggestionItems": [{
"obj": "003"
},{
"obj": "004"
}]
}]
};
oMasterModel.setData(oDataSet);
oMasterModel.refresh(true);
}
});
});
解决方法
尝试添加斜杠。就像这样/ suggestionItems}“>
<ComboBox items="{oMasterModel>/suggestionItems}">
<core:Item key="{oMasterModel>obj}" text="{oMasterModel>obj}"/>
</ComboBox>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。