View Full Version : [FIXED-1214] Ext.onReady getting fired multiple times

7 Oct 2010, 4:15 AM
We have Ext.onReady in multiple user controls of a single page. Until Ext 3.2 version, this gets fired only once after the whole page is loaded. With Ext 3.3 rc, it seems to be getting fired multiple times.

In the thread http://www.sencha.com/forum/showthread.php?107208-OPEN-1214-Ext.onReady-code-changed-in-3.3x&highlight=OnReady, it was mentioned on 16th August that multiple firing of Ext.onReady was fixed.

Can you please help me with the same?

Thanks in advance.

7 Oct 2010, 4:51 AM
I don't get it -- why would you ever need to call Ext.onReady more than once per page?

7 Oct 2010, 10:31 AM
Ext.onReady(function() {

How many alerts do you get? One, right. So there is no bug with this.

7 Oct 2010, 10:47 AM
He means he has multiple instances of Ext.onReady() on a single page.

7 Oct 2010, 10:56 AM
This is result of his design. If an event is fired, all listeners on this event react. So if you use 4 listeners on Ext.onReady, all 4 are triggered. Correct behaviour.

7 Oct 2010, 11:06 AM
Exactly :) Hence, I'm still curious why you'd *ever* need to call Ext.onReady more than once per page.... But maybe I'm just not thinking outside the box.

7 Oct 2010, 11:43 AM
Depends on the architecture of the app. If you do that in seperate files/classes, it's ok, if they are all included it will happen on one page.
So the only thing you have to take care is not doing same things twice.

7 Oct 2010, 12:41 PM
This is a duplicate of issue #1214, which is still open.

It's correct that in some circumstances the onReady event is fired multiple times, also with ExtJs 3.3 RC. I think it happens when loading CSS / JS dynamically, not with script or CSS HTML tags.

8 Oct 2010, 3:15 AM
We have multiple user controls which are common across pages. Each user control has its own Ext.onReady function to take care of its components. This is the reason we have multiple Ext.onReady calls in one page.

Please note that this has been working fine until 3.2.1 - i.e. if I have an alert in Ext.onReady, it gets shown only once and only after the page has finished loading in the browser. Now when I drop Ext 3.3 rc code, it shows the alert multiple times.

15 Oct 2010, 11:31 AM
Dupe: http://www.sencha.com/forum/showthread.php?107208-INFOREQ-Ext.onReady-code-changed-in-3.3x