我有(通過覆蓋childControlImpl我創建了子女)擴展窗口類(qx.ui.window.Window)和這個窗口現在已經幾個孩子的家長控件。如何訪問用戶控件父定義的方法
現在我想從其中一個子類訪問父類中的方法。我不想創建一個對象來調用方法,而是我想用getLayoutParent方法來做到這一點。
但是,當我可以叫getLayoutParent從子類的方法,我可以訪問是內置的方法,但我不能訪問我所創建的任何方法。
我該怎麼做到這一點?
代碼示例:
qx.Class.define("project.WrkAttrWindow",{
extend : qx.ui.window.Window,
construct: function() {
this.base(arguments);
this.__table = this._createChildControl("table");
},
members: {
__table:null
_createChildControlImpl : function(id)
{
var control;
switch(id)
{
case "table":
control = new project.WrkAttrTable();
this.add(control);
break;
}
return control || this.base(arguments, id);
},
getPrjId:function() {
console.log(I want to call this function);
}
});
子構件
qx.Class.define("project.WrkAttrTable",{
extend: qx.ui.table.Table,
statics: {
colKeys:["id","name","description"]
},
construct: function() {
this.base(arguments);
//some code here
},
members:
{
//call parent method from here
this.getLayoutParent().getPrjId(); // does not work
}
});
的問題也問及nabble.com看到:http://qooxdoo.678.n2.nabble.com/How-to-access-user-defined-methods-of-widget-parent-tp7584648.html –