I get the error following error when trying to open a Dialog fragment a second time after calling this._oDialog.destroy()
:
Uncaught TypeError: Cannot read property 'setInitialFocusId' of null
My problem is like the problem stated here: How to clear dialog/xmlfragment content after close? However, the solution apparently just seems to be "Don't use the property setInitialFocus", which I do not use anywhere in my code.
Controller
openDialog: function() {
if (!this._oDialog) {
this._oDialog = sap.ui.xmlfragment("myFragmentPath", this);
this.getView().addDependent(this._oDialog);
}
this._oDialog.open();
},
onExit: function () {
if (this._oDialog) {
this._oDialog.destroy();
}
},
afterClose: function () {
if (this._oDialog) {
this._oDialog.destroy();
}
},
handleClose: function (oEvent) {
this._oDialog.close();
}
Dialog Fragment
<Dialog xmlns="sap.m" afterClose=".afterClose">
<!-- ... -->
</Dialog>
Main XML View
<Button press=".openDialog" />
Additional info:
- The error message occurs in the Controller line when
this._oDialog.open();
is called. - I am using the sap library version 1.60.1.