在控制器中创建 StandardListItem 并按下项目上的事件不会触发
Creating StandardListItem in controller and press event on item won't fire
我们在控制器中创建 StandardListItems 时遇到问题。我们这样做是因为我们必须调用与 bindItems 相关的另一个 OData 端点,以获取附件列表。您可以在 Detail Controller 中看到该部分。在正常 XML 视图中按下 属性 将调用相关控制器中的函数。
我们预计以下方法会产生相同的行为。因此 handleItemPress 是处理程序,将在按下项目后调用。
但如前所述,什么也没有发生。
我们为新闻事件尝试了不同的表示法(绑定和不绑定):
press: [this.handleItemPress, this]
press: this.handleItemPress
press: "handleItemPress"
None 他们中的一些虽然有效。那么,我们可以做些什么来使物品上的压力发挥作用?
详细视图:
<IconTabFilter
icon="sap-icon://attachment"
key="AttachmentTab"
text="{i18n>Attachments}">
<List
id="AttachmentList"
includeItemInSelection="true">
</List>
</IconTabFilter>
详细控制器:
if (evt.getParameter("key") === "AttachmentTab") {
var template = new sap.m.StandardListItem({
title: "{Objecttext}",
description: "{Filename}",
icon: {
path: "Type",
formatter: sap.ui.prototype.approval.util.Formatter.attachmentIcon
},
press: [this.handleItemPress, this]
});
this._byId("AttachmentList").bindItems(
"/Invoices(Bukrs='" + bukrs + "',Belnr='" + belnr + "',Gjahr='" + gjahr + "',EdcObject='" + edcObject + "')/Attachments",
template
);
}
},
handleItemPress : function (evt){
console.log("The item was pressed");
},
为 StandardListItem 设置类型 属性。
var template = new sap.m.StandardListItem({
type: "Active",
title: "{Objecttext}",
description: "{Filename}",
我们在控制器中创建 StandardListItems 时遇到问题。我们这样做是因为我们必须调用与 bindItems 相关的另一个 OData 端点,以获取附件列表。您可以在 Detail Controller 中看到该部分。在正常 XML 视图中按下 属性 将调用相关控制器中的函数。
我们预计以下方法会产生相同的行为。因此 handleItemPress 是处理程序,将在按下项目后调用。
但如前所述,什么也没有发生。
我们为新闻事件尝试了不同的表示法(绑定和不绑定):
press: [this.handleItemPress, this]
press: this.handleItemPress
press: "handleItemPress"
None 他们中的一些虽然有效。那么,我们可以做些什么来使物品上的压力发挥作用?
详细视图:
<IconTabFilter
icon="sap-icon://attachment"
key="AttachmentTab"
text="{i18n>Attachments}">
<List
id="AttachmentList"
includeItemInSelection="true">
</List>
</IconTabFilter>
详细控制器:
if (evt.getParameter("key") === "AttachmentTab") {
var template = new sap.m.StandardListItem({
title: "{Objecttext}",
description: "{Filename}",
icon: {
path: "Type",
formatter: sap.ui.prototype.approval.util.Formatter.attachmentIcon
},
press: [this.handleItemPress, this]
});
this._byId("AttachmentList").bindItems(
"/Invoices(Bukrs='" + bukrs + "',Belnr='" + belnr + "',Gjahr='" + gjahr + "',EdcObject='" + edcObject + "')/Attachments",
template
);
}
},
handleItemPress : function (evt){
console.log("The item was pressed");
},
为 StandardListItem 设置类型 属性。
var template = new sap.m.StandardListItem({
type: "Active",
title: "{Objecttext}",
description: "{Filename}",