You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Patrick Klein <pa...@bi-so.de> on 2006/11/17 14:50:03 UTC

Ajax, For-Loops and PropertySelections

Hi!

I'm trying to use Ajax to update the content of a for-loop containing 
PropertySelections. The template for the table i want to update looks 
like this:

<form jwcid="testForm@Form" async="ognl:true" 
updateComponents="ognl:updateComponents">
    <table>
         <tr>
            <th>Test</th>
            <th>Result</th>
            <th>Target</th>
        </tr>
        <tr jwcid="@For" element="tr" source="ognl:dataList" 
value="ognl:data">
1)         <td jwcid="@PropertySelection" id="ognl:data.testId" 
model="ognl:testModel" value="ognl:data.test"/>
2)         <td jwcid="@PropertySelection" id="ognl:data.resultId" 
model="ognl:dynamicResultModel" value="ognl:data.result"/>
3)         <td jwcid="@PropertySelection" id="ognl:data.targetId" 
model="ognl:dynamicTargetModel" value="ognl:data.target"/>
            <td jwcid="@Any" id="ognl:data.updateBlockId">
                <div jwcid="@TextField" id="ognl:data.outputId" 
value="ognl:data.output"/>
            </td>
        </tr>
    </table>
</form>

id's are uniquely generated and found correctly inside the generated 
html-code. onchange EventListeners are given for the property 
selections. EventListeners are name so it is clear which element has 
caused the event.
What i'm trying to accomplish is the following:
User changes value of selection 1). This activates EventListener 
(async=true). This part actually works... that far. Now the 
PropertyModel of 2) should be changed (note that the table holds more 
then one line).
Changes on 2) have an impact on the selection in 3), changes in 3) 
manipulate the output-field of the line.

All this is working perfectly outside the for-loop.

The problem now is that my selection-model goes amoc if change one of 
the properties a second time (numberFormatException in 
PropertySelection.translateValue(String s), s is actually null). 
Additionally not only the addressed selections get updated (e.g. 
changing the first selection in a line should only have an impact on the 
second and maybe third selection of the same line), but at least too 
other selections. The Browser shows a Property Selection with another 
PropertySelection inside instead of the updated selection.

The main problem seems to that i need to address the selections to 
update uniquely, but how? The data-iterator is firmly on the last value 
is it is not null already and will be next updated on rewind...

Can anyone help me out here?

thnx in advance,
Patrick

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


Re: Ajax, For-Loops and PropertySelections

Posted by Patrick Klein <pa...@bi-so.de>.
Hi, once more

Sorry, completely forgot the real problem...

The downstep with the solution we use now is that it is pretty static, 
which would've been avoided using a for loop
It looks like the following:

html-template:
[...]
<form jwcid="testForm@Form" async="ognl:true" 
updateComponents="ognl:updateComponents">
    <table>
        <tr>
            <th>Test</th>
            <th>Result</th>
            <th>Target</th>
        </tr>
        <div jwcid="dataPosition0"/>
        <div jwcid="dataPosition1"/>
    </table>
</form>
[...]

As you can see one has to define each and every data-row statically 
inside the template itself. So you have to know which amount of data 
you're going to visualize.

page-file:
[...]
<component id="dataPosition0" type="DataPosition">
    <binding name="data" value="data0"/>
</component>
[...]

Assuming that the component is DataPosition. Each parameter-binding 
needs it's own getter in the page's java-class.
The Component will put together the property selection and store them 
into an abstract setter/getter to access them asynchronously. The 
approach of getting them directly from the building method did not work 
for me. The prepareForRender-method will do the updating.
Additionally one needs to make sure that the components get unique ids 
and that they are wrapped into surrounding divs/tds if needed. As far as 
i tested it out here, @TextField and @Checkbox Components need such a 
wrapper (with it's unique id), for @PropertySelection it is essential 
that there is no wrapper used according to my experience with 
AJAX-Components here.
The html-template of the component could look like this:

<tr jwcid="@Any" id="ognl:componentId">
    <td>
        <div jwcid="@PropertySelection" id="ognl:testId" 
clientId="ognl:testId" model="ognl:testModel" value="ognl:data.test"/>
    </td>
    <td jwcid="@Any" id="ognl:updateResultId">
        <div jwcid="@PropertySelection" id="ognl:resultId" 
clientId="ognl:resultId" model="ognl:ResultSelectionModel" 
value="ognl:data.result"/>
    </td>
    <td jwcid="@Any" id="ognl:updateTargetId">
        <div jwcid="@PropertySelection" id="ognl:targetId" 
clientId="ognl:targetId" model="ognl:TargetSelectionModel" 
value="ognl:data.target"/>
    </td>
    <td jwcid="@Any" id="ognl:updateBlockId">
        <div jwcid="@TextField" id="ognl:outputId" 
clientId="ognl:outputId" value="ognl:data.output"/>
    </td>
</tr>

In case of the PropertySelection, e.g. resultId and targetId get 
updated, in order to update  the TextField one needs to update the id 
updateBlockId

In the main class, there need to be a getter for the updateComponents 
property. It needs to contain all DOM-ids you possibly want to update. 
Maybe there one could take a little control by not putting all 
theoretically possible ids in but only the id's which need to be updated 
according to the underlying data. That far i haven't tested the approach 
yet.

One of the EventListeners in the page's java-class could look like that:

@EventListener(elements = { "testSelection0", "testSelection1" }, events 
= "onchange", submitForm = "testForm", async = true)
public void adjustResultModelMultiple(BrowserEvent event) {
    String elementId = getCallingElementId(event); // see earlier mail
    System.out.println("adjustResultModelMultiple called for " + 
elementId); // debug purposes
    String targetId = null;
    Data data = null;

    if (elementId.equalsIgnoreCase("testSelection0")) {
        targetId = "resultSelection0";
        data = getDataList().get(0);
    } else if (elementId.equalsIgnoreCase("testSelection1")) {
        targetId = "resultSelection1";
        data = getDataList().get(1);
    } else {
        return;
    }

    adjustData(data);

    System.out.println("adjustResultModelMultiple: DOM id to update: " + 
targetId); // again debug prupose
    getRequestCycle().getResponseBuilder().updateComponent(targetId);
}

Here the approach is pretty static, too, as one needs to find out the 
data to be altered from the DOM-id causing the event additionally to the 
DOM-Nodes to be updated.

Thats basically the solution i'm using.
Downside is, as mentioned above, the static way. Another problem was 
that in the last tests it didn't work with IE but i guess there's only a 
bit of finetuning needed...

Patrick

> Please post your solution to the list.  It makes it much easier for
> other folks to find it later.
>
> --sam
>
>
> On 11/21/06, Patrick Klein <pa...@bi-so.de> wrote:
>> Nevermind, found it 2 minutes after hitting the send button :)
>>
>> Patrick
>> > Hi!
>> >
>> > I scraped the for-loop in favor of a hardcoded list of components
>> > which does the trick for our needs here. It would have been nicer the
>> > way below (and much more flexible) but i could not find a working
>> > solution for the problem using this approach.
>> > Now another question came up:
>> > Using an EventListener with an Array of DOM-elements (e.g.
>> > @EventListener(elements={"tag_1", "tag_2", ..., "tag_x"}, ...)) is
>> > there a way to find out, for which element the listener was activated?
>> > I checked BowserEvent and IRequestCycle but found nothing suitable so
>> > far...
>> >
>> > Patrick
>> >> Hi!
>> >>
>> >> I'm trying to use Ajax to update the content of a for-loop containing
>> >> PropertySelections. The template for the table i want to update looks
>> >> like this:
>> >>
>> >> <form jwcid="testForm@Form" async="ognl:true"
>> >> updateComponents="ognl:updateComponents">
>> >>    <table>
>> >>         <tr>
>> >>            <th>Test</th>
>> >>            <th>Result</th>
>> >>            <th>Target</th>
>> >>        </tr>
>> >>        <tr jwcid="@For" element="tr" source="ognl:dataList"
>> >> value="ognl:data">
>> >> 1)         <td jwcid="@PropertySelection" id="ognl:data.testId"
>> >> model="ognl:testModel" value="ognl:data.test"/>
>> >> 2)         <td jwcid="@PropertySelection" id="ognl:data.resultId"
>> >> model="ognl:dynamicResultModel" value="ognl:data.result"/>
>> >> 3)         <td jwcid="@PropertySelection" id="ognl:data.targetId"
>> >> model="ognl:dynamicTargetModel" value="ognl:data.target"/>
>> >>            <td jwcid="@Any" id="ognl:data.updateBlockId">
>> >>                <div jwcid="@TextField" id="ognl:data.outputId"
>> >> value="ognl:data.output"/>
>> >>            </td>
>> >>        </tr>
>> >>    </table>
>> >> </form>
>> >>
>> >> id's are uniquely generated and found correctly inside the generated
>> >> html-code. onchange EventListeners are given for the property
>> >> selections. EventListeners are name so it is clear which element has
>> >> caused the event.
>> >> What i'm trying to accomplish is the following:
>> >> User changes value of selection 1). This activates EventListener
>> >> (async=true). This part actually works... that far. Now the
>> >> PropertyModel of 2) should be changed (note that the table holds more
>> >> then one line).
>> >> Changes on 2) have an impact on the selection in 3), changes in 3)
>> >> manipulate the output-field of the line.
>> >>
>> >> All this is working perfectly outside the for-loop.
>> >>
>> >> The problem now is that my selection-model goes amoc if change one of
>> >> the properties a second time (numberFormatException in
>> >> PropertySelection.translateValue(String s), s is actually null).
>> >> Additionally not only the addressed selections get updated (e.g.
>> >> changing the first selection in a line should only have an impact on
>> >> the second and maybe third selection of the same line), but at least
>> >> too other selections. The Browser shows a Property Selection with
>> >> another PropertySelection inside instead of the updated selection.
>> >>
>> >> The main problem seems to that i need to address the selections to
>> >> update uniquely, but how? The data-iterator is firmly on the last
>> >> value is it is not null already and will be next updated on rewind...
>> >>
>> >> Can anyone help me out here?
>> >>
>> >> thnx in advance,
>> >> Patrick
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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


Re: Ajax, For-Loops and PropertySelections

Posted by Patrick Klein <pa...@bi-so.de>.
Hi!

Here it is. To be  called from the EventListener-Methods which get the 
BrowserEvent as parameter.

    public String getCallingElementId(BrowserEvent event) {
        return (String) event.getTarget().get(BrowserEvent.TARGET_ATTR_ID);
    }

Patrick
> Please post your solution to the list.  It makes it much easier for
> other folks to find it later.
>
> --sam
>
>
> On 11/21/06, Patrick Klein <pa...@bi-so.de> wrote:
>> Nevermind, found it 2 minutes after hitting the send button :)
>>
>> Patrick
>> > Hi!
>> >
>> > I scraped the for-loop in favor of a hardcoded list of components
>> > which does the trick for our needs here. It would have been nicer the
>> > way below (and much more flexible) but i could not find a working
>> > solution for the problem using this approach.
>> > Now another question came up:
>> > Using an EventListener with an Array of DOM-elements (e.g.
>> > @EventListener(elements={"tag_1", "tag_2", ..., "tag_x"}, ...)) is
>> > there a way to find out, for which element the listener was activated?
>> > I checked BowserEvent and IRequestCycle but found nothing suitable so
>> > far...
>> >
>> > Patrick
>> >> Hi!
>> >>
>> >> I'm trying to use Ajax to update the content of a for-loop containing
>> >> PropertySelections. The template for the table i want to update looks
>> >> like this:
>> >>
>> >> <form jwcid="testForm@Form" async="ognl:true"
>> >> updateComponents="ognl:updateComponents">
>> >>    <table>
>> >>         <tr>
>> >>            <th>Test</th>
>> >>            <th>Result</th>
>> >>            <th>Target</th>
>> >>        </tr>
>> >>        <tr jwcid="@For" element="tr" source="ognl:dataList"
>> >> value="ognl:data">
>> >> 1)         <td jwcid="@PropertySelection" id="ognl:data.testId"
>> >> model="ognl:testModel" value="ognl:data.test"/>
>> >> 2)         <td jwcid="@PropertySelection" id="ognl:data.resultId"
>> >> model="ognl:dynamicResultModel" value="ognl:data.result"/>
>> >> 3)         <td jwcid="@PropertySelection" id="ognl:data.targetId"
>> >> model="ognl:dynamicTargetModel" value="ognl:data.target"/>
>> >>            <td jwcid="@Any" id="ognl:data.updateBlockId">
>> >>                <div jwcid="@TextField" id="ognl:data.outputId"
>> >> value="ognl:data.output"/>
>> >>            </td>
>> >>        </tr>
>> >>    </table>
>> >> </form>
>> >>
>> >> id's are uniquely generated and found correctly inside the generated
>> >> html-code. onchange EventListeners are given for the property
>> >> selections. EventListeners are name so it is clear which element has
>> >> caused the event.
>> >> What i'm trying to accomplish is the following:
>> >> User changes value of selection 1). This activates EventListener
>> >> (async=true). This part actually works... that far. Now the
>> >> PropertyModel of 2) should be changed (note that the table holds more
>> >> then one line).
>> >> Changes on 2) have an impact on the selection in 3), changes in 3)
>> >> manipulate the output-field of the line.
>> >>
>> >> All this is working perfectly outside the for-loop.
>> >>
>> >> The problem now is that my selection-model goes amoc if change one of
>> >> the properties a second time (numberFormatException in
>> >> PropertySelection.translateValue(String s), s is actually null).
>> >> Additionally not only the addressed selections get updated (e.g.
>> >> changing the first selection in a line should only have an impact on
>> >> the second and maybe third selection of the same line), but at least
>> >> too other selections. The Browser shows a Property Selection with
>> >> another PropertySelection inside instead of the updated selection.
>> >>
>> >> The main problem seems to that i need to address the selections to
>> >> update uniquely, but how? The data-iterator is firmly on the last
>> >> value is it is not null already and will be next updated on rewind...
>> >>
>> >> Can anyone help me out here?
>> >>
>> >> thnx in advance,
>> >> Patrick
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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


Re: Re: Ajax, For-Loops and PropertySelections

Posted by Sam Gendler <sg...@ideasculptor.com>.
Please post your solution to the list.  It makes it much easier for
other folks to find it later.

--sam


On 11/21/06, Patrick Klein <pa...@bi-so.de> wrote:
> Nevermind, found it 2 minutes after hitting the send button :)
>
> Patrick
> > Hi!
> >
> > I scraped the for-loop in favor of a hardcoded list of components
> > which does the trick for our needs here. It would have been nicer the
> > way below (and much more flexible) but i could not find a working
> > solution for the problem using this approach.
> > Now another question came up:
> > Using an EventListener with an Array of DOM-elements (e.g.
> > @EventListener(elements={"tag_1", "tag_2", ..., "tag_x"}, ...)) is
> > there a way to find out, for which element the listener was activated?
> > I checked BowserEvent and IRequestCycle but found nothing suitable so
> > far...
> >
> > Patrick
> >> Hi!
> >>
> >> I'm trying to use Ajax to update the content of a for-loop containing
> >> PropertySelections. The template for the table i want to update looks
> >> like this:
> >>
> >> <form jwcid="testForm@Form" async="ognl:true"
> >> updateComponents="ognl:updateComponents">
> >>    <table>
> >>         <tr>
> >>            <th>Test</th>
> >>            <th>Result</th>
> >>            <th>Target</th>
> >>        </tr>
> >>        <tr jwcid="@For" element="tr" source="ognl:dataList"
> >> value="ognl:data">
> >> 1)         <td jwcid="@PropertySelection" id="ognl:data.testId"
> >> model="ognl:testModel" value="ognl:data.test"/>
> >> 2)         <td jwcid="@PropertySelection" id="ognl:data.resultId"
> >> model="ognl:dynamicResultModel" value="ognl:data.result"/>
> >> 3)         <td jwcid="@PropertySelection" id="ognl:data.targetId"
> >> model="ognl:dynamicTargetModel" value="ognl:data.target"/>
> >>            <td jwcid="@Any" id="ognl:data.updateBlockId">
> >>                <div jwcid="@TextField" id="ognl:data.outputId"
> >> value="ognl:data.output"/>
> >>            </td>
> >>        </tr>
> >>    </table>
> >> </form>
> >>
> >> id's are uniquely generated and found correctly inside the generated
> >> html-code. onchange EventListeners are given for the property
> >> selections. EventListeners are name so it is clear which element has
> >> caused the event.
> >> What i'm trying to accomplish is the following:
> >> User changes value of selection 1). This activates EventListener
> >> (async=true). This part actually works... that far. Now the
> >> PropertyModel of 2) should be changed (note that the table holds more
> >> then one line).
> >> Changes on 2) have an impact on the selection in 3), changes in 3)
> >> manipulate the output-field of the line.
> >>
> >> All this is working perfectly outside the for-loop.
> >>
> >> The problem now is that my selection-model goes amoc if change one of
> >> the properties a second time (numberFormatException in
> >> PropertySelection.translateValue(String s), s is actually null).
> >> Additionally not only the addressed selections get updated (e.g.
> >> changing the first selection in a line should only have an impact on
> >> the second and maybe third selection of the same line), but at least
> >> too other selections. The Browser shows a Property Selection with
> >> another PropertySelection inside instead of the updated selection.
> >>
> >> The main problem seems to that i need to address the selections to
> >> update uniquely, but how? The data-iterator is firmly on the last
> >> value is it is not null already and will be next updated on rewind...
> >>
> >> Can anyone help me out here?
> >>
> >> thnx in advance,
> >> Patrick
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: Ajax, For-Loops and PropertySelections

Posted by Patrick Klein <pa...@bi-so.de>.
Nevermind, found it 2 minutes after hitting the send button :)

Patrick
> Hi!
>
> I scraped the for-loop in favor of a hardcoded list of components 
> which does the trick for our needs here. It would have been nicer the 
> way below (and much more flexible) but i could not find a working 
> solution for the problem using this approach.
> Now another question came up:
> Using an EventListener with an Array of DOM-elements (e.g. 
> @EventListener(elements={"tag_1", "tag_2", ..., "tag_x"}, ...)) is 
> there a way to find out, for which element the listener was activated? 
> I checked BowserEvent and IRequestCycle but found nothing suitable so 
> far...
>
> Patrick
>> Hi!
>>
>> I'm trying to use Ajax to update the content of a for-loop containing 
>> PropertySelections. The template for the table i want to update looks 
>> like this:
>>
>> <form jwcid="testForm@Form" async="ognl:true" 
>> updateComponents="ognl:updateComponents">
>>    <table>
>>         <tr>
>>            <th>Test</th>
>>            <th>Result</th>
>>            <th>Target</th>
>>        </tr>
>>        <tr jwcid="@For" element="tr" source="ognl:dataList" 
>> value="ognl:data">
>> 1)         <td jwcid="@PropertySelection" id="ognl:data.testId" 
>> model="ognl:testModel" value="ognl:data.test"/>
>> 2)         <td jwcid="@PropertySelection" id="ognl:data.resultId" 
>> model="ognl:dynamicResultModel" value="ognl:data.result"/>
>> 3)         <td jwcid="@PropertySelection" id="ognl:data.targetId" 
>> model="ognl:dynamicTargetModel" value="ognl:data.target"/>
>>            <td jwcid="@Any" id="ognl:data.updateBlockId">
>>                <div jwcid="@TextField" id="ognl:data.outputId" 
>> value="ognl:data.output"/>
>>            </td>
>>        </tr>
>>    </table>
>> </form>
>>
>> id's are uniquely generated and found correctly inside the generated 
>> html-code. onchange EventListeners are given for the property 
>> selections. EventListeners are name so it is clear which element has 
>> caused the event.
>> What i'm trying to accomplish is the following:
>> User changes value of selection 1). This activates EventListener 
>> (async=true). This part actually works... that far. Now the 
>> PropertyModel of 2) should be changed (note that the table holds more 
>> then one line).
>> Changes on 2) have an impact on the selection in 3), changes in 3) 
>> manipulate the output-field of the line.
>>
>> All this is working perfectly outside the for-loop.
>>
>> The problem now is that my selection-model goes amoc if change one of 
>> the properties a second time (numberFormatException in 
>> PropertySelection.translateValue(String s), s is actually null). 
>> Additionally not only the addressed selections get updated (e.g. 
>> changing the first selection in a line should only have an impact on 
>> the second and maybe third selection of the same line), but at least 
>> too other selections. The Browser shows a Property Selection with 
>> another PropertySelection inside instead of the updated selection.
>>
>> The main problem seems to that i need to address the selections to 
>> update uniquely, but how? The data-iterator is firmly on the last 
>> value is it is not null already and will be next updated on rewind...
>>
>> Can anyone help me out here?
>>
>> thnx in advance,
>> Patrick
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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


Re: Ajax, For-Loops and PropertySelections

Posted by Patrick Klein <pa...@bi-so.de>.
Hi!

I scraped the for-loop in favor of a hardcoded list of components which 
does the trick for our needs here. It would have been nicer the way 
below (and much more flexible) but i could not find a working solution 
for the problem using this approach.
Now another question came up:
Using an EventListener with an Array of DOM-elements (e.g. 
@EventListener(elements={"tag_1", "tag_2", ..., "tag_x"}, ...)) is there 
a way to find out, for which element the listener was activated? I 
checked BowserEvent and IRequestCycle but found nothing suitable so far...

Patrick
> Hi!
>
> I'm trying to use Ajax to update the content of a for-loop containing 
> PropertySelections. The template for the table i want to update looks 
> like this:
>
> <form jwcid="testForm@Form" async="ognl:true" 
> updateComponents="ognl:updateComponents">
>    <table>
>         <tr>
>            <th>Test</th>
>            <th>Result</th>
>            <th>Target</th>
>        </tr>
>        <tr jwcid="@For" element="tr" source="ognl:dataList" 
> value="ognl:data">
> 1)         <td jwcid="@PropertySelection" id="ognl:data.testId" 
> model="ognl:testModel" value="ognl:data.test"/>
> 2)         <td jwcid="@PropertySelection" id="ognl:data.resultId" 
> model="ognl:dynamicResultModel" value="ognl:data.result"/>
> 3)         <td jwcid="@PropertySelection" id="ognl:data.targetId" 
> model="ognl:dynamicTargetModel" value="ognl:data.target"/>
>            <td jwcid="@Any" id="ognl:data.updateBlockId">
>                <div jwcid="@TextField" id="ognl:data.outputId" 
> value="ognl:data.output"/>
>            </td>
>        </tr>
>    </table>
> </form>
>
> id's are uniquely generated and found correctly inside the generated 
> html-code. onchange EventListeners are given for the property 
> selections. EventListeners are name so it is clear which element has 
> caused the event.
> What i'm trying to accomplish is the following:
> User changes value of selection 1). This activates EventListener 
> (async=true). This part actually works... that far. Now the 
> PropertyModel of 2) should be changed (note that the table holds more 
> then one line).
> Changes on 2) have an impact on the selection in 3), changes in 3) 
> manipulate the output-field of the line.
>
> All this is working perfectly outside the for-loop.
>
> The problem now is that my selection-model goes amoc if change one of 
> the properties a second time (numberFormatException in 
> PropertySelection.translateValue(String s), s is actually null). 
> Additionally not only the addressed selections get updated (e.g. 
> changing the first selection in a line should only have an impact on 
> the second and maybe third selection of the same line), but at least 
> too other selections. The Browser shows a Property Selection with 
> another PropertySelection inside instead of the updated selection.
>
> The main problem seems to that i need to address the selections to 
> update uniquely, but how? The data-iterator is firmly on the last 
> value is it is not null already and will be next updated on rewind...
>
> Can anyone help me out here?
>
> thnx in advance,
> Patrick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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