Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 875 Bytes

using-dialogs-defined-as-fragments-aeb86c1.md

File metadata and controls

25 lines (16 loc) · 875 Bytes

Using Dialogs Defined as Fragments

The fragment instantiation function always returns the fragment's root control, which is a dialog control that can be used like any dialog.

Context

In the following example, the dialog is opened immediately:

// "this" has to be the controller instance of a controller extending module "sap/ui/core/mvc/Controller"
async openDialog() {
	this.oDialog ??= await this.loadFragment({
		name: "testdata.fragments.XMLFragmentDialog"
	});
	this.oDialog.open();
}

Note:

Any global model and any models set on the controller's view are automatically available for data binding within this dialog. The fragment content is automatically added to the view's dependents aggregation. In consequence, the dialog is also automatically destroyed once the view is destroyed.