Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1113 closed defect (invalid)

addOnLoad fires before newly inserted content is loaded in FireFox

Reported by: guest Owned by: bill
Priority: high Milestone:
Component: Widgets Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

When Dojo widgets are inserted into a ContentPane? along with javascript that calls dojo.addOnLoad, the onload code gets executed right away and doesn't wait for the widgets to render. This seems to be a problem in FireFox? and not IE. Here's an example that illustrates the problem.

<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01EN" "http://www.w3.org/TR/html4/strict.dtd">

<html> <head> <script type="text/javascript">

djConfig = {

isDebug: false, disableFlashStorage: true, preventBackButtonFix: false, baseRelativePath: "../js/dojo/"

};

</script> <script type="text/javascript" src="../js/dojo/dojo.js"></script> <script language="JavaScript?" type="text/javascript">

dojo.require("dojo.widget.ContentPane?"); dojo.require("dojo.widget.SplitContainer?"); dojo.require("dojo.widget.LayoutContainer?"); function mainFunction() {

var contentToBeInserted = dojo.byId('toBeInserted').innerHTML; alert('getting ready to insert the following content:

' + contentToBeInserted);

dojo.widget.byId('contentContainer').setContent(contentToBeInserted); alert('content has been set');

}

</script> <style>

html, body{ width: 100%; height: 100%; overflow: hidden; padding: 0 0 0 0; margin: 0 0 0 0; }

.dojoSplitPane{ margin: 5px; }

</style> </head> <body>

<div id="contentContainer" dojoType="ContentPane?" layoutAlign="client" executeScripts="true" style="width: 100%; height: 100%;">

This is the starting main content<br> <button onClick="mainFunction()">click me</button>

</div>

<div id="toBeInserted" style="display:none;">

<script language="JavaScript?" type="text/javascript">

dojo.addOnLoad(function(){

alert('This is getting called too early in FireFox?!

(just ignore this message the first time through)');

});

</script> <div dojoType="SplitContainer?" orientation="horizontal" sizerWidth="5" activeSizing="0" style="width: 100%; height: 100%; background: #eeeeee; padding: 10px;">

<div dojoType="ContentPane?" sizeShare="20" style="background:red;">

This is the left pane.

</div> <div dojoType="ContentPane?" sizeShare="50" style="background:green;">

This is the right pane

</div>

</div>

</div>

</body> </html>

Attachments (1)

example.txt (1.9 KB) - added by guest 13 years ago.
This is code that illustrates the problem

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by guest

Attachment: example.txt added

This is code that illustrates the problem

comment:1 Changed 13 years ago by bill

Resolution: invalid
Status: newclosed

Not a bug, use _container_.addOnLoad(). See http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book30

comment:2 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.