PDA

View Full Version : How to override Ext.create()



url
8 Nov 2012, 4:49 AM
Hi all,

How can we override Ext.create. The functionality should be in such a way that when ever an object is getting created the overridden create method should be called.

Any help would be really appreciated.

Regards
url

vietits
8 Nov 2012, 5:53 AM
Try this:


Ext.$create = Ext.create;
Ext.create = function(){
// your code here
return Ext.$create.apply(Ext, arguments);
}

Also, you can use Ext.Function.interceptBefore(), Ext.Function.interceptAfter().

url
8 Nov 2012, 9:15 PM
Hi veitis
Thanx for ur quick response.

My requirement is to add unique id to each object which is getting created using Ext.create method and should show that id's in one panel/window. This panel/window should be displayed in application's viewport. If the object is destroyed then the color of id should be changed.

Any help would be really appreciated.

Thanx

Zinnia
9 Nov 2012, 12:07 AM
While defining the object, assign a random value to the id property that may solve your problem.

Thanks