dojo.parser.parse only working first time it's called.
Posted
by crazymerlin
on Stack Overflow
See other posts from Stack Overflow
or by crazymerlin
Published on 2009-10-19T19:33:20Z
Indexed on
2010/05/28
11:01 UTC
Read the original article
Hit count: 209
dojo
I have a page that when a user clicks on a link for some reporting tools, it first asks them to enter some report parameters. I get the parameters dialog as a form using AJAX, based on the id of the link. Each dialog has some dojo controls on it, so I need to parse them when the dialog appears, because it is not originally part of the page.
The first dialog when called works fine, but subsequent calls to dialogs fails to parse the dojo controls.
Example:
showParametersDialog : function(doc) {
var content = doc.firstChild.firstChild.data;
var container = document.createElement('div');
container.id = 'dialog';
container.innerHTML = content;
container.style.background = 'transparent';
container.style.position = 'absolute';
container.style.top = (document.body.clientHeight / 2) - 124 + "px";
container.style.left = (document.body.clientWidth / 2) - 133 + "px";
container.style.display = 'block';
document.body.appendChild(container);
// set up date fields
var date_from = dojo.byId('date_from');
var date_to = dojo.byId('date_to');
try {
date_from.value = dojo.date.locale.format(new Date(), {selector: 'date'});
date_to.value = dojo.date.locale.format(new Date(), {selector: 'date'});
} catch(e) {
var now = new Date();
date_from.value = String(now.getMonth() + "/" + now.getDate() + "/" + now.getFullYear());
date_to.value = String(now.getMonth() + "/" + now.getDate() + "/" + now.getFullYear());
}
dojo.parser.parse();
}
All dialogs have the common date fields. So when I call this dialog the first time, and dojo.parser.parse() is called, it parses the controls on the dialog, but only the first time...after than, no dojo.
Any thoughts?
Thanks, Paul.
© Stack Overflow or respective owner