View Full Version : Add Event Listener to Component Before it is Rendered?

30 Jan 2015, 8:30 AM
Hey all, I'm hoping someone can help me think outside of the box here. I have to attach an event listener to an Ext component the least invasive way possible. Basically we have have a COTS product which uses Ext 3.4 and I don't want to muck with the code unless I have to. I'd rather just add a script include to the page which will execute once the page is rendered. The code adds a 'load' listener to a store by getting the Ext component using Ext.getCmp. The problem is the component isn't created until a button is clicked by the user and even then it's rendered a few milliseconds after that. Any way I can 'wait' (not synchronously, or course) for the component to be rendered and then once it's available attach my listener? The only think I could come up with is attaching a listener to the button, but even then I suspect there would be a timing discrepancy between when that is fired and when the component is actually available.

Thanks in advance!

30 Jan 2015, 8:34 PM
Hi robhyx--

Can you add a render event listener to your component, and do whatever processing you need to do there?