Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#8275 closed defect (fixed)

DTL Template Rendering - Widget Rendering somtimes failed

Reported by: gchan Owned by: Neil Roberts
Priority: high Milestone: 1.3
Component: DojoX DTL Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:

Description

Background Info: Dojo Version: 1.2.3 OS: Ubuntu 8.03 Browser: Firefox 3.0.4 (It also occurs with OS X 10.5 Firefox 3.0.4 as well)

Description: A widget is created using Dojo's DTL templating engine. Sometimes the widget failed to render. (It occurs more frequently if user have an empty cache and load the page for the first time)

For the problem widget, render() is called in postCreate() within the onComplete handler of dojox.data.JsonRestStore?.fetch(). (please see attached code for the problem widget source. (dtlload.js, dtlload.html and data1.js)

According the the Dojo book that is currently online, this should be not be a problem.

"postCreate

This is typically the workhorse of a custom widget. The widget has been rendered (but note that sub-widgets in the containerNode have not!)"

http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/writing-your-own-widget-class/widget-life-cycl

Two firebug screen capture is also attached. Note that in both cases render() was called twice. The case where the render() is successful, first render() call is finished before the second render() call is called. In the case where it failed, the second render() call start before the first one is finished.

Attachments (5)

data1.js (466 bytes) - added by gchan 11 years ago.
sample data
dtlload.js (6.5 KB) - added by gchan 11 years ago.
widget JavaScript? source
dtlload.html (727 bytes) - added by gchan 11 years ago.
widget template file
Dojo DTL Render Failed.png (130.8 KB) - added by gchan 11 years ago.
Firebug screen capture when rendering failed
Dojo DTL Render Success.png (126.2 KB) - added by gchan 11 years ago.
Firebug screen capture when rendering is successful

Download all attachments as: .zip

Change History (15)

Changed 11 years ago by gchan

Attachment: data1.js added

sample data

Changed 11 years ago by gchan

Attachment: dtlload.js added

widget JavaScript? source

Changed 11 years ago by gchan

Attachment: dtlload.html added

widget template file

Changed 11 years ago by gchan

Attachment: Dojo DTL Render Failed.png added

Firebug screen capture when rendering failed

Changed 11 years ago by gchan

Attachment: Dojo DTL Render Success.png added

Firebug screen capture when rendering is successful

comment:1 Changed 11 years ago by gchan

Nite: Custom tracing code was added to dojox.dtl._HtmlTemplated. At the start and end of both buildrender() and render().

comment:2 in reply to:  1 Changed 11 years ago by gchan

Replying to gchan:

Nite: Custom tracing code was added to dojox.dtl._HtmlTemplated. At the start and end of both buildrender() and render().

Note not Nite.

comment:3 Changed 11 years ago by Adam Peller

Component: GeneralDojox
Owner: changed from anonymous to Neil Roberts

comment:4 Changed 11 years ago by liucougar

try moving your logic in postCreate to preCreate, and you don't need to call render(), after preCreate() is called, render() will be called for you

comment:5 Changed 11 years ago by gchan

I have moved all the code from postCreate to preCreate. I have an "data_bind didn't receive a store" error.

comment:6 Changed 11 years ago by Adam Peller

Component: DojoxDojoX DTL

comment:7 Changed 10 years ago by dante

Milestone: tbdfuture

comment:8 Changed 10 years ago by Neil Roberts

Resolution: fixed
Status: newclosed

comment:9 Changed 10 years ago by Neil Roberts

Code should be moved to postMixInProperties. A default template can be set here as well

comment:10 Changed 10 years ago by Adam Peller

Milestone: future1.3

batch move of tickets marked 'future' in the 1.3 timeframe

Note: See TracTickets for help on using tickets.