If you are developing in pure ExtJs, you have 3 options to be able to get a reference to a Component after it has been instantized (and you have not maintained an explicit reference to it): specifying id for the component in the config options for the Component, specifying an itemId config option, or using the ref config option. However, none of these approaches is without its shortcomings.
id is almost always the least preferable option. You need to make sure manually that all items on the page whose ids are explicitly set by you are unique, which becomes quite difficult to ensure as the size and number of developers on the project increase.
itemId allows you to specify an id which is scoped locally for the container of the Component. However, if you have many deeply nested containers and components, getting your hands to a component considerably down in the hierarchy from a container listener function pretty up again becomes troublesome.
Now if you are using Ext.Net/Coolite, the framework by default generates unique client-side ids for your Components, in accordance with ASP.NET’s NamingContainer rules. Again, you do not have an easy intuitive way to guess these ids on the client-side. Another option is to use the IDMode property on your Ext.NET controls. However, as soon as you use any of the Static, Explicit, or ExplicitClientID values for this enumeration property, the onus shifts on to you to ensure the uniqueness of Client Ids corresponding to the server id you set on the control.
Even ref and item ids are not of much use firstly because of extremely deep and nested container hierarchies (imagine a button inside a toolbar, inside a panel, inside a tab panel, inside a panel, inside a border layout, inside a window, and the need to access the button when the window is shown, and this is still a hugely simplified hierarchy).
More importantly, when the UserControl is invoked for dynamic rendering in an ajax call because of user interaction, arbitrary containers need to be injected in the control hierarchy depending upon the data from the database. This leaves any possibility of using itemId or ref defunct to be able to reference components in event listeners.
Well, that was the introduction to the problem. I will discuss how have we approached the issue and settled on a standard solution for this in a following blog post.
UPDATE: The new post with a solution to the issue is now available here – Maintaining Component References in ExtJs/Ext.Net applications – Part II.