如何解决如何在SAPUI5中的JavaScript对话框中添加关闭按钮?
我正在尝试向JavaScript视图对话框添加按钮。 不幸的是,该按钮没有显示(页眉按钮) 实际上,我希望对话框在角落有另一个按钮,以关闭对话框
this.oWarningMessageDialog = new Dialog({
type: DialogType.Message,title: this._oBundle.getText("PaymentPostponement"),state: ValueState.Warning,Header: new Button({
type: ButtonType.Reject,icon: "sap-icon://decline",press: function (oEvent) {
this.oWarningMessageDialog.close()
this.oWarningMessageDialog = null
Core.byId("ApproveMessageText").destroy()
}.bind(this)
}),beginButton: new Button({
type: ButtonType.Reject,text: this._oBundle.getText("Postpone"),
解决方法
如果需要图像中指定的确切外观,则需要使用'customHeader'聚合。代码如下:-
this.oWarningMessageDialog = new Dialog({
type: DialogType.Message,state: ValueState.Warning,customHeader: [
new sap.m.Bar({
/* either use an icon */
contentRight: new sap.ui.core.Icon({
src : "sap-icon://decline",useIconTooltip : false,color : "#f33334",press : function (oEvent) {
this.oWarningMessageDialog.close();
this.oWarningMessageDialog = null;
Core.byId("ApproveMessageText").destroy()
}.bind(this)
}).addStyleClass("sapUiMediumMarginBottom"),/* or you can even use a button */
// contentRight: new Button({
// type: ButtonType.Transparent,// icon: "sap-icon://decline",// width: "20px",// press: function (oEvent) {
// this.oWarningMessageDialog.close();
// this.oWarningMessageDialog = null;
// }.bind(this)
// }).addStyleClass("sapUiSmallMarginBottom"),contentMiddle : [
new sap.m.Title({
text :this._oBundle.getText("PaymentPostponement")
}),new sap.ui.core.Icon({
src : "sap-icon://message-warning",color : "#E69A17"
})
]
})
],beginButton: new Button({
type: ButtonType.Reject,text: this._oBundle.getText("Postpone"),icon: "sap-icon://decline"
})
});
或者,包含关闭按钮的正确方法是使用“ endButton”聚合。但这将在对话框的页脚中显示按钮。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。