The jquery function load() doesn't load correctly dojo content
In my web site I've multiple calls of the jquery function load().
We can sumarize like this :
1) In My index page calls this $('#mainFrame').load('/antoherPage.jsp');
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css"/><script type="text/java开发者_开发问答script" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig="parseOnLoad: true,locale: 'en'"></scipt>
2) In my another page, it calls this $('#main').load('/Form.jsp');
3) In 'Form', I've some field from dijit : dijit.form.ValidationTextBox, ...
<input dojoType='dijit.form.ValidationTextBox'></input>
In my index page, I've this :
Basically, if I load the page Form.jsp, everyhting is correctly displayed. However, when I load my index page, everyhting is not correctly diplayed in the Form.
I'd like to know if I need to write some special code into the form page or into another page. Maybe the multiple calls of the load is not accepted by dojo/dijit?
Thank you very much
Bat
After you ajax load a page, you need to call dojo.parser.parse()
. Dojo has no idea that you are loading another page via ajax, and thus the parser doesn't know to look through the new content for dijit widgets in markup.
You'll need to dojo.require('dojo.parser')
as well.
EDIT: looking at the jquery load docs, a more full featured example would be:
$('#main').load('/Form.jsp', function() {
//make sure we have the dojo.parser component pulled in, although it should probably be done in <head>
dojo.require('dojo.parser');
dojo.parser.parse();
});
As always, the dojo.parser component should be loaded prior to the execution of that ajax call
精彩评论