我正在FlexColumnLayout内的特定控件上打开一个弹出窗口。取决于屏幕尺寸,一旦中间栏展开,它将不会呈现。
我想在打开弹出窗口之前检查cotrol是否已渲染,但是我似乎找不到允许该属性的属性。
已经尝试过此帖子的解决方案: Check if a control is currently rendered and visible
如果您想在实际代码中进行测试,请使用FlexColumnLayout的演示应用程序,并在扩展开始列时尝试在其中一个隐藏按钮上打开弹出窗口。
感谢您的帮助,埃里克
编辑27.08.18(相关代码):
控制器:
/**
* Listner. Triggered when help is canceled.
* Closes popover.
* @author WN00096217 (Eric Schuster)
* @memberof xxxxxxxxxxxx
* @function onHelpCancel
*/
onHelpCancel: function () {
var iHelp = this._oHelpModel.getProperty("/counter");
this._oHelpModel.setProperty("/counter", 0);
this._oHelpModel.getProperty("/p" + iHelp).close();
},
/**
* Listner. Triggered when help is continue.
* Closes popover, opens next popover.
* @author WN00096217 (Eric Schuster)
* @memberof xxxxxxxxxxxxxxxxxxx
* @function onHelpNext
*/
onHelpNext: function () {
var iHelp = this._oHelpModel.getProperty("/counter");
this._oHelpModel.setProperty("/counter", iHelp + 1);
this._oHelpModel.getProperty("/p" + iHelp).close();
this._oHelpModel.getProperty("/p" + (iHelp + 1)).openBy(this._oHelpModel.getProperty("/c" + (iHelp + 1)));
},
控制器(innit的一部分):
this._oHelpModel.setProperty("/c0", this._oView.byId("xxxxx"));
this._oHelpModel.setProperty("/c1", this._oView.byId("xxxx"));
this._oHelpModel.setProperty("/c2", this._oView.byId("xxxxx"));
this._oHelpModel.setProperty("/c3", this._oView.byId("xxxxxx"));
this._oHelpModel.setProperty("/c4", this._oView.byId("xxxxxx"));
this._oHelpModel.setProperty("/c5", this._oView.byId("xxxxx"));
this._oHelpModel.setProperty("/c6", this._oView.byId("xxxxx"));
this._oHelpModel.setProperty("/c7", this._oView.byId("xxxxxx"));
this._oHelpModel.setProperty("/c8", this._oView.byId("xxxxx"));
组件(innit的一部分):
//p eq popover c eq controll
var oHelpModel = new JSONModel({
counter: 0,
p0: null,
c0: null,
p1: null,
c1: null,
p2: null,
c2: null,
p3: null,
c3: null,
p4: null,
c4: null,
p5: null,
c5: null,
p6: null,
c6: null,
p7: null,
c7: null,
p8: null,
c8: null
});
this.setModel(oHelpModel, "helpModel");
我希望控制器看起来像什么:
/**
* Listner. Triggered when help is continue.
* Closes popover, opens next popover.
* @author WN00096217 (Eric Schuster)
* @memberof xxxxxxxxxxxxxxxxx
* @function onHelpNext
*/
onHelpNext: function () {
var iHelp = this._oHelpModel.getProperty("/counter");
if("control is rendered"){
this._oHelpModel.setProperty("/counter", iHelp + 1);
this._oHelpModel.getProperty("/p" + iHelp).close();
this._oHelpModel.getProperty("/p" + (iHelp + 1)).openBy(this._oHelpModel.getProperty("/c" + (iHelp + 1)));
} else {
this._oHelpModel.setProperty("/counter", iHelp + 1);
this.onHelpNext();
return;
}
},
答案 0 :(得分:2)
使用控件的onAfterRendering
事件。在相应视图的controller
中:
var oControl = this.byId("yourControl");
oControl.addEventDelegate({
onAfterRendering: function() {
// your confirmation that the control is rendered
}
}
明确说明后,更新:
给控件一个ID(如果还没有ID的话)。通过其ID获取控件。检查控件是否处于活动状态。在您相应视图的控制器中:
var oControl = this.byId("yourControl");
oControl.isActive(); // true if the control is visible