ExtJS: Use several times Ext.onReady
Recently using the Javascript framework comprehensive to ExtJS (3.2.1) to work in a fairly complex PHP application (based on Zend Framework), one of the first questions that came in the team was: "Is Can I make multiple calls to the function Ext.onReady? "
The answer was not so easy to find. On different forums, opinions were divided (Some advised against multiply Ext.onReady calls, but never explained why).
Finally, I found this document , in which it is written that the Ext.onReady function saves only the methods to execute when the DOM elements on the page are loaded. These functions are then stacked in the order in which you call them. Question: By calling several times Ext.onReady, all functions will they be added to the same stack?
Answer: yes.
I tested a page where 100 calls (let's be crazy) to the Ext.onReady function were performed, each of these calls a manager object. No problems reported, and the page seemed as fast as loading the 100 objects in a single function Ext.onReady.
This can be good to know if you plan to use ExtJS in MVC applications to multiple modules. ![]()












Last comments