I am working on two qooxdoo classes:
main.container:
qx.Class.define("main.container",
{
type: "singleton",
extend: webfrontend.gui.CustomWindow,
construct: function() {
this.base(arguments);
this.setLayout( new qx.ui.layout.VBox());
var info = new qx.ui.container.Composite( new qx.ui.layout.VBox());
this.add(info);
this.info = info;
},
destruct: function(){},
members: {
info: null,
__setInfo: function(array) {
this.info.removeAll();
for(var i = 0; i < array.length; i++) {
var label = new qx.ui.basic.Label(array[i]);
this.info.add(label);
}
}
}
});
main.widget:
qx.Class.define("main.widget",
{
type: "singleton",
extend: qx.ui.core.Widget,
construct: function() { ... },
members: {
__sendData: function(data) {
var cont = main.container.getInstance();
var setInfo = cont.__setInfo;
setInfo(data);
},
__onHover: function() {
var data = ....
this.__sendData(data);
}
}
});
I am trying to retrieve data from the main.widget
class and pass it to the main.container
class to add labels to the info container.
However, when I execute this code, I encounter an error
TypeError: Cannot call method 'removeAll' of undefined
, but running main.container.getInstance().__setInfo([...])
in the console works!
What am I doing incorrectly and how can I resolve it?
qooxdoo playground