我因为输入表格式建议而无法工作。问题是我想在控制器内创建输入字段。我找到了this example,但是它使用XML视图来创建字段。
我试图将示例转换为JS,但是从构造行和列开始,我确实遇到了很多错误。我该如何实现呢?这就是我的尝试:
new sap.m.Input({
visible: "{= ${UserId} === '' ? true : false}",
/* showValueHelp="true",*/
showSuggestion: true,
valueHelpRequest: "onManageServiceOwners",
suggest: "handleInputSuggest",
/* suggestionRows: "{ path: 'serviceDetailsModel>/SuggestedServiceOwners' }",*/
suggestionRows: sap.m.input.insertSuggestionRow(item, -1) ,
suggestionColumns: sap.m.input.insertSuggestionColumn(oSuggestionColumn, -1),
submit: (this.onSubmitOwnerId).bind(this)
})
答案 0 :(得分:1)
在XML视图中,您拥有它in the SDK samples。
使用JS + XML视图,您可以在此处找到a working demo和摘录:
var oInput = new sap.m.Input({
showSuggestion: true,
showTableSuggestionValueHelp: false,
suggestionColumns: [
new sap.m.Column({
label: new sap.m.Label({ text: "Name" })
}),
new sap.m.Column({
label: new sap.m.Label({ text: "ProductId" })
}),
new sap.m.Column({
label: new sap.m.Label({ text: "SupplierName" })
})
],
suggestionRows: {
path: "/ProductCollection",
template: new sap.m.ColumnListItem({
cells: [
new sap.m.Text({
text: { path: "Name" }
}),
new sap.m.Text({
text: { path: "ProductId" }
}),
new sap.m.Text({
text: { path: "SupplierName" }
})
]
})
},
});