Jul 29, 2012, 8:25 PM
[CLOSED] Custom component ID creation difference with v 1.x
Hi,
In v 1.x of Ext.NET if I created a subclass of an Ext.NET component, I was able to do this:
The other reason I like this is that if my custom component has some listeners then I can make those listeners be implemented as client side instance methods (e.g. Fn = "#{" + ID + "}.myMethod" ).
If I do this in v2.0 latest (or 2.1 latest) the id does not get created if the user of the component does not set an explicit id so I cannot call instance methods on the client side if needed.
Is it possible to have the 1.x behaviour in 2.x, or is there a suitable alternative that can be recommended?
In v 1.x of Ext.NET if I created a subclass of an Ext.NET component, I was able to do this:
private static int _instanceCount;
public override string ID
{
get { return base.ID ?? (base.ID = "MyId" + Interlocked.Increment(ref _instanceCount)); }
set { base.ID = value; }
}
The above is quite handy because if a user did not set an explicit ID for an instance, it would default to a reasonably predictable one (overriding IDMode to be Explicit made it even more easier to predict).The other reason I like this is that if my custom component has some listeners then I can make those listeners be implemented as client side instance methods (e.g. Fn = "#{" + ID + "}.myMethod" ).
If I do this in v2.0 latest (or 2.1 latest) the id does not get created if the user of the component does not set an explicit id so I cannot call instance methods on the client side if needed.
Is it possible to have the 1.x behaviour in 2.x, or is there a suitable alternative that can be recommended?
Last edited by Daniil; Jul 31, 2012 at 1:46 PM.
Reason: [CLOSED]