我的图标标签条形码:
new sap.m.IconTabBar("iconTabBar", {
expandable: false,
expanded: false,
items: [
new sap.m.IconTabFilter({
text: "Orders",
key: "All",
icon: "sap-icon://home"
}),
new sap.m.IconTabFilter("iconTabFilter6", {
text: "Open",
key: "Open",
icon: "sap-icon://home"
}),
new sap.m.IconTabFilter({
text: "In Process",
key: "InProcess",
icon: "sap-icon://home"
})
]
});
我放expanded: false
所以没有选择标签。现在如何选择一个特定的选项卡?说第二个(Open
)。
我尝试了什么:
var open = iconTabBar.getItems()[1]; // retruning 2nd Item
open.setExpanded(true); // error: getItems(...)[1].setExpanded is not a function
答案 0 :(得分:2)
在您的代码示例中,您将expanded
属性设置为IconTabFilter
,而不是IconTabBar
。
尝试使用所需setSelectedKey
的密钥在IconTabBar
上设置IconTabFilter
答案 1 :(得分:0)
new sap.m.IconTabBar("iconTabBar", {
selectedKey = "Open",
items: [
new sap.m.IconTabFilter({
text: "Orders",
key: "All",
icon: "sap-icon://home"
}),
new sap.m.IconTabFilter("iconTabFilter6", {
text: "Open",
key: "Open",
icon: "sap-icon://home"
}),
new sap.m.IconTabFilter({
text: "In Process",
key: "InProcess",
icon: "sap-icon://home"
})
]
});