It looks like you're doing everything okay (and well explained) If you
enable debugging do you get any useful feedback ?
<s:head theme="ajax" debug="true"/>
The complexity here is that Dojo must parse the response, extract the
scripts, insert the html in the dom and then execute the scripts. If
you include an alert in an inline script and it's still not being
executed then there's definitely a problem with it completing the last
operation. You may have to switched to the uncompressed dojo script to
find out where it's failing in within the div widget.
Jukka Välimaa wrote:
Hi everyone,
I'm using Struts 2.1's ajax tags to replace content in a section of my page.
I have this section enclosed in sx:div tags, like so:
<sx:div id="pageContentSection" preload="false" href="%{myUrl}"
listenTopics="/reloadContentSection"
afterNotifyTopics="/contentSectionLoaded" executeScripts="true"
showLoadingText="true" separateScripts="true" indicator="barIndicator">
..
</sx:div>
I change the div content by editing its href with javascript and then
publishing the topic it's listening to:
function reloadContentSection(url){
if(!isAnUrl(url)) return false;
var contentSection = dojo.widget.byId("pageContentSection");
if(contentSection == null) return false;
var origHref = contentSection.href;
contentSection.href = url;
dojo.event.topic.publish('/reloadContentSection', '','');
contentSection.href =origHref;
}
It's working fine otherwise, but I have trouble executing scripts in
returned content. I've experimented with different values of executeScripts
and separateScripts to no effect. I've even tried to include scripts as a
reference to separate javascript library--no better luck there. Even though
scripts I write don't work, a datetimepicker in the same returned content,
done using ajax tags and of course relying on scripts, works perfectly.
When I set separateScripts as false, my scripts are included in generated
DOM source, after some scripts by Matt Cruse, which I assume are directly
related to struts ajax functionality. Of course, being included doesn't mean
that they work.
Right now, I've worked around this problem by including the scripts I need
in the page I'm calling ajax from, and not in returned content. I don't
think this is good design, and won't work if I need to generate scripts
dynamically.
Can any of you tell me what's wrong, or how to fix it?
Jukka
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.23.0/1379 - Release Date: 15/04/2008 6:10 PM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]