View Full Version : What events to rely on when a View gets initialized?
8 Dec 2011, 6:00 PM
On extending Ext.Component or Ext.Container to create a View, I've been using 'painted' as the indicator that a view has been placed in the DOM and correctly constructed. Now, 'painted' seems to be firing twice, so seems like 'show' is the only choice left for this. Why isn't there a 'render' event that gets fired only once?
8 Dec 2011, 7:33 PM
painted gets fired anytime your component element is shown in the browser. erased is called anytime it is hidden.
There is a bug in PR2 where the painted event gets fired twice. There is a ticket opened for that already.
As for a render event, it cannot exist. There is simply no such thing anymore in ST2 as a components element is always rendered (just not necessarily in the dom, just in memory).
What we suggest you do is override the initialize method (ensure you call callParent()), and do your logic in there. The component element will already exist by the point, but it will not be added into the dom (this will only happen when it needs to).
9 Dec 2011, 4:17 AM
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.