PDA

View Full Version : protype or superclass ?



fxlacroix
15 May 2009, 1:43 AM
hello,

I got problem to call a parent method when instancing an object
i got a code like this :


this.dragZone = new Ext.tree.MultiTreeDragZone(this, {
ddGroup: this.dragGroup,
scroll: true,
getDragData: function(e){

this.constructor.superclass.getDragData.call(this);
// this.constructor.prototype.getDragData();

var dragData = this.prototype.getDragData

return dragData;
},

...ect



if i copy the content of the getDragData MultiTreeDragZone in my getDragData function, it works... but the code is the same; consequently i want to erase it and to call the method from my child method (like the superclass.call when extending).
By doing this, i got a scope problem...

an idea to have the same comportement of the copy/paste method ?

i don't know if this post is clear....
thx in advance

Animal
15 May 2009, 3:04 AM
this.constructor.prototype

http://extjs.com/learn/Tutorial:Creating_new_UI_controls#When_a_subclass_is_not_needed

fxlacroix
15 May 2009, 3:52 AM
Thx animal !