Hi, Isomorphic,
due a fact that SmartClient do not allow to override methods in a consistent way ( impossible to call parent method if any method exists on class), we are using this technique:
It worked pretty well till overriden method is called first in class graph (e.g. var a = isc.ListGrid.create({}); a.doSomething(); )
but if we have a class Menu extends ListGrid; and variable var b = isc.Menu.create({}); b.doSomething(); it will trigger endless recursion.
Found a problem in: ISC_Core.js: invokeSuper(...) method:
nativeArguments.callee != methodCallingSuper
This condition is always true, because callee do not match to original method in ListGrid, and it causes endless recursion because nextProto will direct to the same class.
Could you please tell me how to avoid this recursion? Or how to do overriding in proper way (I need to override certain method in SmartClient's default class and call back it's parent implementation too)?
A solution would be to use property '_originalMethod' which will point to original method as `methodCallingSuper = isc.Class._getOriginalMethod(methodName, this);` will do resolving to real, but I do not think it's proper solution.
due a fact that SmartClient do not allow to override methods in a consistent way ( impossible to call parent method if any method exists on class), we are using this technique:
Code:
var superMethod = isc.ListGrid.getInstanceProperty('xxx'); isc.ListGrid.addMethods({ xxx: function () { // do own stuff.. superMethod.apply(this, arguments); } }
but if we have a class Menu extends ListGrid; and variable var b = isc.Menu.create({}); b.doSomething(); it will trigger endless recursion.
Found a problem in: ISC_Core.js: invokeSuper(...) method:
Code:
if (nativeArguments && nativeArguments.callee != null && nativeArguments.callee != methodCallingSuper) { //this.logWarn("recursion detected: to continue current super chain caller" + // " should be: " + this.echoLeaf(methodCallingSuper) + // " but caller is: " + this.echoLeaf(nativeArguments.callee)); methodCallingSuper = isc.Class._getOriginalMethod(methodName, this); nextProto = staticSuper ? this : this.getPrototype(); }
This condition is always true, because callee do not match to original method in ListGrid, and it causes endless recursion because nextProto will direct to the same class.
Could you please tell me how to avoid this recursion? Or how to do overriding in proper way (I need to override certain method in SmartClient's default class and call back it's parent implementation too)?
A solution would be to use property '_originalMethod' which will point to original method as `methodCallingSuper = isc.Class._getOriginalMethod(methodName, this);` will do resolving to real, but I do not think it's proper solution.
Comment