开发者

[t5.2.6]Generating zones within a loop, then updating some of them

I've been trying to do this for some time now but nothing worked. I searched through this list and I still can't figure it out !!

Here is my case, I draw a table using dimensions provided in the page activation context. So I can't predict how many rows or columns I may have. Each header in the columns have a select field and so does each row at it's left most cell. Each select field should update the whole row or column, depending on which select field had it's value changed.

Here is a portion of my page's tml file to elaborate more. The "???" are just to not that I need the select to update zones but I just don't know what to put here !

<t:form>
    <div style="overflow: auto;">
        <table class="contentpane skyTable" width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
            <tr>
                <td bgcolor="lightgray"/>
                <td t:type="loop" t:source="1 .. width" t:value="widthIndex">
                    ${widthIndex} - <t:select t:id="toNode" model="toProbesModel" zone="???"/>
                </td>
            </tr>
            <tr t:type="loop" t:source="1 .. height" t:value="heightIndex">
                <td>${heightIndex} - <t:select t:id="fromNode" model="fromProbesModel" zone="???"/></td>
                <t:loop t:source="1 .. width" t:value="widthIndex">
                    <td row="${heightIndex}" col="${widthIndex}" from="" to="" style="background-color: #BDBDBD;">
                        <t:zone id="${widthIndex}-${heightIndex}">
                            N/A
                        </t:zone>
                    </td>
                </t:loop>
            </tr>
        </table>
    </div>
</t:form>

The w开发者_StackOverflow社区hole idea is to add more info to the XHR request, this will most probably aid to fix my problem.

If this is kinda not possible at the moment. May be someone can help me to request fragments of pages to load in these using prototype ajax calls rather that using tapestry's capabilities although I'd hate that !! I wanna be good using tapestry :)

Also I need to modify the cells being updated "style" attribute to add an image as it's background and remote that attribute when a cell is fully updated. Just to show a loader gif.

In addition, Assuming a column will be updated due to a select value is changed, each cell in this column should have a specific attribute in it, changed to the new value of the select field. And the same story with rows. Each cell about to update in a row, needs to have a specific attribute in it to be changed to the value of the select field. These attribute will be within the "td" element.

To summer this up, I need to collect some parameters from the page at the client side and add the to the zone' activation context which is the same as the page's, but I can detect if it's an XHR request from there.

I already have this working using servlets but I'd LOVE to use tapestry instead :)

Thanks a lot.


The zone you specify should just be any zone that exists. Which one does not really matter as you will need to specify server side in your event method which zone's to update with what content using the MultiZoneUpdater. Have a look at this example on how.

On a different note, if you create a table header, you might want to use the THEAD, TH and TBODY tags in stead of using a regulair old TR TD combo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜