Sapui5 如何在项目模板中添加IconTabSeparator?
我有一个带有JSON视图的SAPUI5应用程序。下面是JSON视图的代码Sapui5 如何在项目模板中添加IconTabSeparator?,sapui5,tabbar,Sapui5,Tabbar,我有一个带有JSON视图的SAPUI5应用程序。下面是JSON视图的代码 "sections": [ { "id": "idMenuButtonSection", "subSections": [ { "main": [ { "Type": "sap.m.IconTabBar", "headerMode": "Inline", "headerBackgrou
"sections": [
{
"id": "idMenuButtonSection",
"subSections": [
{
"main": [
{
"Type": "sap.m.IconTabBar",
"headerMode": "Inline",
"headerBackgroundDesign": "{widgetModel>/headerBackgroundDesign}",
"items": [
{
"path": "widgetModel>/filters",
"template": {
"Type": "sap.m.IconTabFilter",
"showAll": "{widgetModel>showAll}",
"enabled": "{widgetModel>enabled}",
"text": "{widgetModel>text}",
"icon": "{widgetModel>icon}",
"iconColor": "{widgetModel>color}",
"count": "{widgetModel>count}",
"content": [
{
"Type": "sap.m.Button",
"text": "{widgetModel>text}"
}
]
}
}
]
}
]
}
]
}
]}
我想再添加一个聚合,即IconTabSeparator
。我该怎么补充呢
当我使用模板时,是否可以在JSON视图中发送分隔符?我应该在控制器中添加分隔符吗?我通过扩展现有控件(sap.m.icontabar)解决了这个问题。我在元数据中添加了一个属性,它是分隔符,在事件委派
onbeforeredering
中,我添加了以下代码
let items = this.getAggregation('items');
let itemsLength = items.length - 1,
j = 1;
if (itemsLength > 0) {
for (let i = 0; i < itemsLength; i++) {
this.insertAggregation('items',
new sap.m.IconTabSeparator({ icon: this.getSeparator() }),
j, true);
j = j + 2;
}
}
let items=this.getAggregation('items');
设itemsLength=items.length-1,
j=1;
如果(项目长度>0){
for(设i=0;i