我们已经使用fiori元素创建了列表报告应用。现在,我们想引发一个关于“保存”操作的对话框,因此我们使用了ExtensionAPI for object page extensions
function onDialog(oEvent) {
if (!That._oDialog) {
sap.ui.core.Fragment.load({
name: "MyProject.MyDialog",
controller: this
}).then(function (oDialog) {
That._oDialog = oDialog;
That.getView().addDependent(That._oDialog);
That._oDialog.getBinding("items").filter(oFilters);
That._oDialog.open();
}.That(That));
} else {
That._oDialog.getBinding("items").filter(oFilters);
That._oDialog.open();
}
}
sap.ui.controller("NextGenerationMaintenanceUI.ext.controller.ObjectPageExt", {
onAfterRendering: function () {
debugger;
this.extensionAPI.getTransactionController().attachAfterSave(onDialog);
}
});
不幸的是,我们无法访问视图控制器并收到错误“ TypeError :(中间值)。这不是函数”
这应该起作用,不要使用它:
then(function (oDialog) {
this._oDialog = oDialog;
this.getView().addDependent(That._oDialog);
this._oDialog.getBinding("items").filter(oFilters);
this._oDialog.open();
}.bind(this))