Opened 11 years ago

Closed 10 years ago

Last modified 9 years ago

#5220 closed defect (fixed)

dojox.layout.ContentPane errors when refreshOnShow set

Reported by: guest Owned by: bill
Priority: high Milestone: 1.3
Component: DojoX Layout Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

Description:

I have a dojox.layout.ContentPane? within a dijit.layout.TabContainer?. I'm using the dojox version so I can run scripts in the pages easily. Also refreshOnShow is set so the pages are downloaded each time.

This simple html page will reproduce the error:

<html>
  <head>
  <script type="text/javascript" src="../dojo-release-1.0.0/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
  <script type="text/javascript" src="../dojo-release-1.0.0/dijit/dijit.js"></script>
  <script type="text/javascript">
    dojo.require('dijit.layout.TabContainer');
    dojo.require('dojox.layout.ContentPane');
  </script>
  <style type="text/css">
    @import "../dojo-release-1.0.0/dijit/themes/tundra/tundra.css";
    @import "../dojo-release-1.0.0/dojo/resources/dojo.css";
  </style>
  </head>
  <body class="tundra">
   <div dojoType="dijit.layout.TabContainer" id="tab_container" style="width: 50%; height: 50%; margin: 10%;">
    <div dojoType="dojox.layout.ContentPane" id="tab_1" href="tab1.html" title="Tab 1" refreshOnShow="true"></div>
    <div dojoType="dojox.layout.ContentPane" id="tab_2" href="tab2.html" title="Tab 2" refreshOnShow="true"></div>
   </div>
  </body>
</html>

tab1.html and tab2.html are just simple html files in the same folder. e.g.

<html>
  <body>
   <p>Tab 1</p>
  </body>
</html>

To reproduce, open the main page in a browser, click on the second tab to show it, then click on the first tab again. The text "Sorry, an error occurred" appears and the javascript errors below occur.

Dojo Version:

1.0.0

Browser Versions:

(tried on) FF 2.0.0.9, IE 6

Error Message:

Javascript error, line 2210, "Error: already called!"

Firebug gives the following stacktrace (hope it's of some use):

Error("already called!")@:0
()@file:///.../dojo-release-1.0.0/dojo/dojo.js:2210
([object Error])@file:///.../dojo-release-1.0.0/dojo/dojo.js:2231
("Download",[object Error])@file:///.../dojo-release-1.0.0/dojo/dojo.js:575
call([object Object],"Download",[object Error])@:0
([object Error])@file:///.../dojo-release-1.0.0/dojo/dojo.js:504
()@file:///.../dojo-release-1.0.0/dojo/dojo.js:2298
([object Object])@file:///.../dojo-release-1.0.0/dojo/dojo.js:2204
([object Object])@file:///.../dojo-release-1.0.0/dojo/dojo.js:2225
([object Object])@file:///.../dojo-release-1.0.0/dojo/dojo.js:6610
(-3)@file:///.../dojo-release-1.0.0/dojo/dojo.js:6530

Contact:

andrew D0T nelis AT gmail D0T com

Change History (17)

comment:1 Changed 11 years ago by guest

Sorry, it says 0.9 as the milestone - that should have been 1.0.0, and I've since tried it on 1.0.1 and the latest in SVN as well to no avail.

-- Andrew.

comment:2 Changed 11 years ago by dylan

Component: GeneralDojox
Milestone: 1.1
Owner: changed from anonymous to Tom Trenka
Version: 0.91.0

comment:3 Changed 11 years ago by dante

Owner: changed from Tom Trenka to mumme

comment:4 Changed 11 years ago by guest

More info on this error:

In dojox.layout.ContentPane.js, the methods _onLoadHandler, _onUnloadHandler and _onError call dojo.Deferred objects this.onLoadDeferred, this.onUnLoadDeferred every time a tab is loaded.

It seems when we re-load the contents of the contentpane, these deferred objects are called again and they don't like that - this is where "already called!" comes from.

I have worked around this for now by resetting the "fired" attribute (to -1) on the deferred objects before they are called. This seems to work although I'm not sure that's the proper way to fix this.

-- Andrew

comment:5 in reply to:  description Changed 11 years ago by guest

Thanks Andrew - this seems to fix other bug we have when navigating between 2 pages containing dojox.layout.ContentPanes? and then returning to the 1st one regardless if we have refreshOnShow or not. We are running with this fix for few months and we are O.K. with it.

Owner - please try to push it to 1.1 so we can remove the local fix we have now

-- tsemachh AT amdocs DOT com

comment:6 Changed 11 years ago by bill

Milestone: 1.21.3
Owner: changed from mumme to Sam Foster

Sam can you take a look at these? Hopefully these are fixed by your refactor or you can fix them

comment:7 Changed 11 years ago by Matt Sgarlata

FWIW, I am getting these errors also when using dojox.layout.ContentPane? and a call like this: contentPane.attr('href', urlHere). A simple work around is to just wrap calls to cancel in try/catch blocks like this

try {
	dijit.layout.ContentPane.prototype.cancel.apply(this, arguments);
}
catch (e) { }

comment:8 Changed 10 years ago by bill

Description: modified (diff)
Owner: changed from Sam Foster to bill
Status: newassigned

comment:9 Changed 10 years ago by bill

The problem is that StackContainer._showChild() calls ContentPane._loadCheck() directly, bypassing dojox.layout.ContentPane._prepareLoad(). _prepareLoad() is needed to reset the deferred objects.

comment:10 Changed 10 years ago by bill

Resolution: fixed
Status: assignedclosed

Fixed in [15876].

comment:11 Changed 10 years ago by acarli82

How i can fix the problem in versione 1.2.x? The version 15876: No changeset in the repository

comment:12 Changed 10 years ago by bill

It's there, it's just that this site was broken and you couldn't see it. Try accessing [15876] now.

comment:13 Changed 10 years ago by bill

(In [15959]) Rollback some of the changes from [15876], which broke mail demo:

TabContainer/StackContainer? should not do sizing in startup(), since, as stated in _LayoutWidget.startup().

In this case the mail demo was failing because:

Fixes #8205, refs #5220 !strict

comment:14 Changed 10 years ago by bill

(In [15964]) Continuation of [15959] for AccordionContainer?, refs #5220 !strict

comment:15 Changed 10 years ago by acarli82

Hi, the fix is ok in versione 1.1.1. But a problem is in the setHref of dijit ContentPane?, the problem is the line

if(this._created){

i have remove this condition and all is ok.

Thank

comment:16 Changed 10 years ago by Nathan Toone

(In [16766]) Refs #5220 - need to update the canGoBack flag each time we are shown as well !strict

comment:17 Changed 9 years ago by bill

Component: DojoxDojoX Layout
Note: See TracTickets for help on using tickets.