You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bhorvat <ho...@gmail.com> on 2013/02/19 00:10:20 UTC

how to send a row information in ajaxformloop

I have a ajaxformloop. The list of objects that I want to display has two
fields. Both of them are enums and I want to be able to refresh the second
enum when I make my selection on the first. For example

Field 1     Filed 2 

name      is
startDate before

My code looks like

<t:form>
    <div t:type="ajaxformloop" t:id="filters" t:source="filterSections"
t:value="currentFilterSection" t:encoder="encoderFilterSection">
          <t:zone t:id="zoneComparator" t:update="show"> 
              <select t:id="selectProperty" t:type="select"
zone="zoneComparator" t:model="propertyModel"
t:value="currentFilterSection.value.properity">
               </select>  
              <select t:type="select" t:model="comparatorModel"
t:value="currentFilterSection.value.comparator">
               </select>                                 
          </t:zone>
   </div>
</t:form>

Now I have done this before when but not in the ajaxformloop. 

The problem that I have here is that I have a list of object and I am not
sure how I can signal what row is being changed. 

I have looked at the documentation of the select but I cant find any way to
send information about the row in question. If I could send that then I
could modify the list.

Any suggestions how this can be achieved?

cheers



--
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-send-a-row-information-in-ajaxformloop-tp5720085.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: how to send a row information in ajaxformloop

Posted by Taha Siddiqi <ta...@gmail.com>.
You can use the popular ZoneUpdater 

http://tinybits.blogspot.in/2010/03/new-and-better-zoneupdater.html

as shown

http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/onevent

regards
Taha

On Feb 19, 2013, at 3:05 PM, bhorvat wrote:

> Hm...I like the approach but I am not sure how easy that is?
> 
> I tried to override it but the component select doesnt expose anything to
> the mixin. 
> 
> Everything is either default, protected or private. I guess another idea
> would be to extend the select component with the suggested behaviour.
> However I dont really like doing that - still if i dont have choice...
> 
> btw is there same way to extend components like this with mixin? It would be
> strange if I cant achieve that and I would really have to create my own
> component
> 
> Thanks for help sody
> 
> cheers
> 
> 
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-send-a-row-information-in-ajaxformloop-tp5720085p5720094.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


Re: how to send a row information in ajaxformloop

Posted by bhorvat <ho...@gmail.com>.
Hm...I like the approach but I am not sure how easy that is?

I tried to override it but the component select doesnt expose anything to
the mixin. 

Everything is either default, protected or private. I guess another idea
would be to extend the select component with the suggested behaviour.
However I dont really like doing that - still if i dont have choice...

btw is there same way to extend components like this with mixin? It would be
strange if I cant achieve that and I would really have to create my own
component

Thanks for help sody

cheers



--
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-send-a-row-information-in-ajaxformloop-tp5720085p5720094.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: how to send a row information in ajaxformloop

Posted by Ivan Khalopik <ik...@gmail.com>.
As far as i understood you can't do this with common tapestry select
component. It has no context for VALUE_CHANGED event except selected value.
But you can try to implement your own logic.
Just copy logic responsible for VALUE_CHANGED event from tapestry select
component to mixin and add context to generated link:

public class MyMixin {

@InjectContainer
private Select component;

@Parameter
private String zone;

@Parameter
private Object[] context;

@AfterRender
void linkZone() {
            Link link = resources.createEventLink("changed", context);
            JSONObject spec = new JSONObject("selectId",
component.getClientId(), "zoneId", zone, "url", link.toURI());
            javascriptSupport.addInitializerCall("linkSelectToZone", spec);
}

//... changed event handler that will trigger VALUE_CHANGED event with
context

}

On Tue, Feb 19, 2013 at 2:10 AM, bhorvat <ho...@gmail.com> wrote:

> I have a ajaxformloop. The list of objects that I want to display has two
> fields. Both of them are enums and I want to be able to refresh the second
> enum when I make my selection on the first. For example
>
> Field 1     Filed 2
>
> name      is
> startDate before
>
> My code looks like
>
> <t:form>
>     <div t:type="ajaxformloop" t:id="filters" t:source="filterSections"
> t:value="currentFilterSection" t:encoder="encoderFilterSection">
>           <t:zone t:id="zoneComparator" t:update="show">
>               <select t:id="selectProperty" t:type="select"
> zone="zoneComparator" t:model="propertyModel"
> t:value="currentFilterSection.value.properity">
>                </select>
>               <select t:type="select" t:model="comparatorModel"
> t:value="currentFilterSection.value.comparator">
>                </select>
>           </t:zone>
>    </div>
> </t:form>
>
> Now I have done this before when but not in the ajaxformloop.
>
> The problem that I have here is that I have a list of object and I am not
> sure how I can signal what row is being changed.
>
> I have looked at the documentation of the select but I cant find any way to
> send information about the row in question. If I could send that then I
> could modify the list.
>
> Any suggestions how this can be achieved?
>
> cheers
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/how-to-send-a-row-information-in-ajaxformloop-tp5720085.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
BR
Ivan