SAPUI5控件:覆盖容器中的名片
在按下enter按钮后,我试图将名片控件放置在UI5中的覆盖容器中。我的代码不起作用,我似乎不知道为什么。在此方面的任何帮助都将不胜感激。我的代码如下:SAPUI5控件:覆盖容器中的名片,sapui5,Sapui5,在按下enter按钮后,我试图将名片控件放置在UI5中的覆盖容器中。我的代码不起作用,我似乎不知道为什么。在此方面的任何帮助都将不胜感激。我的代码如下: var oButton2 = new sap.ui.commons.Button({ text : "Enter", style: sap.ui.commons.ButtonStyle.Emph, width: "75px", press : function() {var oOverlayContainer = new sap.ui.ux3
var oButton2 = new sap.ui.commons.Button({
text : "Enter",
style: sap.ui.commons.ButtonStyle.Emph,
width: "75px",
press : function() {var oOverlayContainer = new sap.ui.ux3.OverlayContainer();
oOverlayContainer.open();
oOverlayContainer.addContent(
function() {var oVCard = new sap.suite.ui.commons.BusinessCard({
firstTitle: new sap.ui.commons.Label({id:"vcard1-name-label",text:"White, Helen",tooltip:"White, Helen"}),
iconPath: "/XMII/CM/MIIDemos/TimeAttendance/images/AtoS_sm.jpg",
secondTitle: "Sales Contact at Customer Side",
imageTooltip:"White, Helen",
width: "424px"
});
var oContentCard = new sap.ui.commons.layout.MatrixLayout({widths:["20px", "100px"]});
var oCell = new sap.ui.commons.layout.MatrixLayoutCell({hAlign:sap.ui.commons.layout.HAlign.Center});
oCell.addContent(new sap.ui.commons.TextView({text:"Phone:"}));
oContentCard.createRow(oCell, new sap.ui.commons.TextView({text:"+41 (635) 457-2875"}));
oCell = new sap.ui.commons.layout.MatrixLayoutCell({hAlign:sap.ui.commons.layout.HAlign.Center});
oCell.addContent(new sap.ui.commons.TextView({text:"E-Mail:"}));
oContentCard.createRow(oCell, new sap.ui.commons.TextView({text:"helen.white@company.com"}));
oContentCard.createRow(new sap.ui.commons.TextView({text:"Address:"}), new sap.ui.commons.TextView({text:"Diermar-Hopp Allee 16"}));
oVCard.setContent(oContentCard);
}
);
}
})
您传递的是函数而不是其结果,应执行以下操作:
var oButton2 = new sap.ui.commons.Button({
text : "Enter",
style: sap.ui.commons.ButtonStyle.Emph,
width: "75px",
press : function() {var oOverlayContainer = new sap.ui.ux3.OverlayContainer();
oOverlayContainer.open();
oOverlayContainer.addContent(
(function() {var oVCard = new sap.suite.ui.commons.BusinessCard({
firstTitle: new sap.ui.commons.Label({id:"vcard1-name-label",text:"White, Helen",tooltip:"White, Helen"}),
iconPath: "/XMII/CM/MIIDemos/TimeAttendance/images/AtoS_sm.jpg",
secondTitle: "Sales Contact at Customer Side",
imageTooltip:"White, Helen",
width: "424px"
});
var oContentCard = new sap.ui.commons.layout.MatrixLayout({widths:["20px", "100px"]});
var oCell = new sap.ui.commons.layout.MatrixLayoutCell({hAlign:sap.ui.commons.layout.HAlign.Center});
oCell.addContent(new sap.ui.commons.TextView({text:"Phone:"}));
oContentCard.createRow(oCell, new sap.ui.commons.TextView({text:"+41 (635) 457-2875"}));
oCell = new sap.ui.commons.layout.MatrixLayoutCell({hAlign:sap.ui.commons.layout.HAlign.Center});
oCell.addContent(new sap.ui.commons.TextView({text:"E-Mail:"}));
oContentCard.createRow(oCell, new sap.ui.commons.TextView({text:"helen.white@company.com"}));
oContentCard.createRow(new sap.ui.commons.TextView({text:"Address:"}), new sap.ui.commons.TextView({text:"Diermar-Hopp Allee 16"}));
oVCard.setContent(oContentCard);
return oVCard;
})()
);
});
确保您还添加了以下LIB:
data-sap-ui-libs="sap.ui.commons, sap.ui.ux3, sap.suite.ui.commons"