Reputation: 430
I created a Class with a Selectbox and some Listitems. To change the Label of these Items I set the Delegate of the selectbox controller with a configureItem
.
Know I want to add some Child Elements of these class and add some Items to the list. Now I have to adjust the configureItem
by calling a function in the configureItem. This Function checks if the Item is in the current class, when it is not I call the superclass method who handles the label of his Items.
This worked well is Qooxdoo 5.0.2. Now I changed to Qooxdoo 6 to use the new compiler and I get the Error: Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
when calling the Superclass Method.
Here are some Code snippets:
//Set Delegate in superclass
this.operatorController.setDelegate({
configureItem : function(item) {
that.operatorDelegateItems(item, that);
}
});
// Superclass Method
operatorDelegateItems : function(item, that) {
switch (item.getLabel()) {
case "":
item.setLabel(qx.locale.Manager.tr("Ist Vorhanden"));
break;
case "-":
item.setLabel(qx.locale.Manager.tr("Ist nicht Vorhanden"));
break;
case "Nachfolger":
item.setLabel(qx.locale.Manager.tr("Zeige Nachfolger"));
break;
}
}
// Child class Delegate FUnction
operatorDelegateItems : function(item, that) {
if (item.getLabel() == "Period")
item.setLabel("Jahresintervall");
else
that.base(arguments, item);
}
Someone can help me with this or is there a better approach to solve my problem?
Upvotes: 1
Views: 103
Reputation: 1003
The problem is that the compiler only supports this.base
and you've aliased this
as that
and so it's not recognised.
I've added this as an issue here (https://github.com/qooxdoo/qooxdoo-compiler/issues/102) and that specific problem needs to be fixed before we release 6.0.
Looking at your code, the fix is that carrying around this
in the that
variable is not necessary, so changing your code to this.base
works (thanks for trying that out on Gitter qooxdoo!)
However, if you weren't able to just change to using this.base
, the work around is to use explicit method calls, eg instead of that.base
you'd use something like
operatorDelegateItems : function(item, that) {
if (item.getLabel() == "Period")
item.setLabel("Jahresintervall");
else
myapp.MyBaseClass.prototype.operatorDelegateItems.call(this, item, that);
}
Upvotes: 1