[英]SAPUI5: How to realize a Menu with the help of MultiComboBox
I muss realize the following Menu: Menu我必须实现以下菜单:菜单
I decide for this Menu to use: MultiComboBox
:我决定使用此菜单:
MultiComboBox
:
<MultiComboBox items="{modelExample>/}" > //Model with a Title and Options
<core:Item text="{modelExample>option}"/>
</MultiComboBox>
Issues问题
The Code does showcase all the Options, don't know yet how to place the Title above the Options to achieve this display.代码确实展示了所有选项,还不知道如何将标题放在选项上方以实现此显示。 What i tried: Link - doesn't really work
我尝试了什么: 链接- 并没有真正起作用
How to add a new Column for the MultiComboBox.如何为 MultiComboBox 添加新列。
If i want to add a new ListItem with the help of controller, it looks as this:如果我想在 controller 的帮助下添加一个新的 ListItem,它看起来像这样:
var l = new sap.ui.core.ListItem("ID"); var label = new sap.m.Label(); label.setText("Hallo Welt"); l.addCell(label); //Cell isn't supported -> those Error MultiComboBox.addItem(l);
Cell
isn't supported by MultiComboBox unlike Table.与 Table 不同,MultiComboBox 不支持
Cell
。 -> How can i add a cell/w/e with a title and all the other Options to the ListItem -> than MultiComboBox.addItem(l)? -> 如何向 ListItem 添加带有标题和所有其他选项的单元格/w/e,而不是 MultiComboBox.addItem(l)?
The "Tile" is the sorter or better the "group" “平铺”是分类器或更好的“组”
<MultiComboBox
selectionChange="handleSelectionChange"
selectionFinish="handleSelectionFinish"
width="500px"
items="{
path: '/ProductCollection',
sorter: {
path: 'SupplierName',
descending: false,
group: true
},
groupHeaderFactory: '.getGroupHeader'
}">
<core:Item key="{ProductId}" text="{Name}" />
</MultiComboBox>
For example.. it group ALL Products with the same SupplierName in the combobox.例如.. 它将 combobox 中具有相同供应商名称的所有产品分组。 I dont know how your model looks but extend it with a group and use it on the sorter
我不知道您的 model 的外观如何,但用一个组扩展它并在分拣机上使用它
and in your controller you need also to mention the function在您的 controller 中,您还需要提及 function
getGroupHeader: function (oGroup) {
return new SeparatorItem( {
text: oGroup.key
});
}
for example your model:例如你的 model:
{
"ProductCollection": [
{
"ProductId": "HT-1000",
"Category": "Laptops",
"MainCategory": "Computer Systems",
"TaxTarifCode": "1",
"SupplierName": "Very Best Screens",
"WeightMeasure": 4.2,
"WeightUnit": "KG",
"Description": "Notebook Basic 15 with 2,80 GHz quad core, 15\" LCD, 4 GB DDR3 RAM, 500 GB Hard Disc, Windows 8 Pro",
"Name": "Notebook Basic 15",
"DateOfSale": "2017-03-26",
"ProductPicUrl": "https://openui5.hana.ondemand.com/test-resources/sap/ui/documentation/sdk/images/HT-1000.jpg",
"Status": "Available",
"Quantity": 10,
"UoM": "PC",
"CurrencyCode": "EUR",
"Price": 956,
"Width": 30,
"Depth": 18,
"Height": 3,
"DimUnit": "cm"
},
{
"ProductId": "HT-1001",
"Category": "Laptops",
"MainCategory": "Computer Systems",
"TaxTarifCode": "1",
"SupplierName": "Very Best Screens",
"WeightMeasure": 4.5,
"WeightUnit": "KG",
"Description": "Notebook Basic 17 with 2,80 GHz quad core, 17\" LCD, 4 GB DDR3 RAM, 500 GB Hard Disc, Windows 8 Pro",
"Name": "Notebook Basic 17",
"DateOfSale": "2017-04-17",
"ProductPicUrl": "https://openui5.hana.ondemand.com/test-resources/sap/ui/documentation/sdk/images/HT-1001.jpg",
"Status": "Available",
"Quantity": 20,
"UoM": "PC",
"CurrencyCode": "EUR",
"Price": 1249,
"Width": 29,
"Depth": 17,
"Height": 3.1,
"DimUnit": "cm"
},
you see "SupplierName": "Very Best Screens"你看到“供应商名称”:“非常好的屏幕”
so if you got 10 items with "SupplierName": "Very Best Screens" it will group under Very Best Screens.因此,如果您有 10 个带有“SupplierName”的项目:“Very Best Screens”,它将分组在“Very Best Screens”下。 If you got 1000 items under "tile1" you have Tile 1
如果您在“tile1”下有 1000 个项目,则您有 Tile 1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.