You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Kristina B. Taylor" <kb...@iastate.edu> on 2008/04/22 18:06:56 UTC

T5: Zones and dojo Dialog

Hi all,

I'm trying to use the new zone capabilities in Tapestry 5 to dynamically 
update a dojo dialog box, but so far I have been unable to get it to 
work properly.  For starters, I generate a whole bunch of actionlinks 
inside of a loop:

<t:loop source="crystalSource" value="currentCrystal">
    <t:actionlink t:id="select" id="${currentCrystal?.id}" 
zone="dialogZone" context="${currentCrystal?.id}" show="show">
                ${currentCrystal?.name}
    </t:actionlink>
</t:loop>

Then I declare a dojo dialog inside of a zone:

<t:zone t:id="dialogZone">
    <div id="dialog" dojo11type="dijit11.Dialog" style="overflow: 
auto;max-height: 300px;" title="${currentCrystal?.name}">
        // more content here
    </div>
</t:zone>

with the updated content relying on the value of currentCrystal.  I have 
a DOM event (as suggested by previous posts) injected into the page that 
watches for the click on the actionlink to launch the dialog, as well as 
an update method:

@Component
private Zone dialogZone;

public Zone onActionFromSelect(int id) {
    this.currentCrystal = crystalDAO.attach(id);
    return dialogZone;
}

void afterRender(MarkupWriter writer) {
    pageRenderSupport.addScript("Event.observe('select_7', 'click', 
function(event) {dijit11.byId('dialog').show();});");
}

Clicking this link launches the dialog box but it has the information 
for the last value of currentCrystal instead of the updated version, and 
the updated version appears directly on the page when I just want it in 
the dialog.  After analyzing the problem, I found why this is 
happening.  There are actually two dialogs declared on the page (with 
the same id).  One is outside the zone, not being updated, but is 
transformed by dojo into an actual dialog:

<div id="dialog" class="dijitDialog 
dijitContentPane" waistate="labelledby-dialog_title" wairole="dialog" tabindex="-1" role="wairole:dialog" aaa:labelledby="dialog_title" style="overflow: 
auto; max-height: 300px; visibility: hidden; position: absolute; top: 
-9999px;" widgetid="dialog" title="">

The other "dialog" is inside the zone but dojo is not transforming it 
into the code above.  I'm not sure whether this is because of the t-zone 
classes surrounding the zone or what.  I tried using the zone id to call 
the dialog, but I can't correctly get that id from 
dialogZone.getClientId() when I inject the script, and dojo still won't 
transform the code into a dialog.

Has anyone ever tried this with Tapestry and Dojo?  Would it be better 
to use JSON data (which I've never used)?  I'm using Tapestry 5.0.11 and 
Dojo 1.1.0.

Thanks in advance,

Kristina

-- 
Kristina B. Taylor

Masters Graduate Student
Department of Computer Science
Iowa State University
Email: kboysen@iastate.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org