在SAPUI5/OpenUI5 xmlfragment文档中,第三个参数是用于处理片段中的操作的控制器.
这对于按下按钮等的对话框片段至关重要.
大部分时间我都看到过这个实例化为this
或sap.ui.getCore().byId('<element>').getController())
请参阅Fragment中的示例未获得正确的Controller
由于特定对话框的复杂性,我希望有一个单独的控制器.
我已经环顾四周并进行了一些尝试,但到目前为止还没有成功.
我已经在github上使用了一个工作示例this
.
但我想实例Dialog.js
化为Dialog.fragment.xml
from 的控制器initial.view.controller
任何接受者?
很高兴收到拉请求.
示例的Crux如下(这是initial.controller.js):
sap.ui.controller("sc.test.view.initial", {
oDialog: null,
openTestDialog: function(){
console.log("in open dialog");
// instantiate the other controller
var oDialogController = new sc.test.view.Dialog();
// this next commented line is the 'normal' way to do it
// oDialog = new sap.ui.xmlfragment( "sc.test.view.Dialog", this); //oDialogController);
// this is what I would like to achieve
oDialog = new …
Run Code Online (Sandbox Code Playgroud)