You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Harshvardhan Kulkarni <ha...@coreobjects.com> on 2005/03/08 10:18:02 UTC

Dynamically setting value for PropertySelection components

Hi All,

My form contains few PropertySelection components which are dynamic.
Only one component is used to render them in a loop.
Code is like following:
(1) .page specification file
        <component id="selectStatus" type="PropertySelection">
	    <binding name="model" expression="dropDownModelForStatus"/>
	    <binding name="value" expression="status"/> 
	    <binding name="submitOnChange" expression="false"/>
  	</component>
(2) .html file
  <tr jwcid="loop@Foreach" source="ognl:categoryList" value="ognl:docCategory" >
     <span jwcid="selectStatus" disabled="false"/>
  </tr>

This component is mapped for setting and getting the value using component 
specification in .page file.
I want to set the value for each component rendered so it should happen in the 
loop.
I have a setter method to set the value for that....i.e. setStatus(String str)

I am not able to pre-set different values for each one of them.

How can i do that?

Thanks,
Harsh



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


Re: Dynamically setting value for PropertySelection components

Posted by Hanson Char <ha...@gmail.com>.
> I am not able to pre-set different values for each one of them.

I suppose you mean to pre-set the selected value for each row in the loop.

The getStatus() for 

>             <binding name="value" expression="status"/>

needs to return the necessary pre-set value per each row, so it will
match up with the corresponding return value of getOption() in your
dropDownModelForStatus.

The getStatus() can figure out which row it is current at by looking
at some row index incremented each time it is invoked, and reset to
the initial value at pageBeginRender(), assuming your page implements
PageRenderListener.

Clear as mud ?  Hope this helps.

H


On Tue, 8 Mar 2005 09:18:02 +0000 (UTC), Harshvardhan Kulkarni
<ha...@coreobjects.com> wrote:
> 
> Hi All,
> 
> My form contains few PropertySelection components which are dynamic.
> Only one component is used to render them in a loop.
> Code is like following:
> (1) .page specification file
>         <component id="selectStatus" type="PropertySelection">
>             <binding name="model" expression="dropDownModelForStatus"/>
>             <binding name="value" expression="status"/>
>             <binding name="submitOnChange" expression="false"/>
>         </component>
> (2) .html file
>   <tr jwcid="loop@Foreach" source="ognl:categoryList" value="ognl:docCategory" >
>      <span jwcid="selectStatus" disabled="false"/>
>   </tr>
> 
> This component is mapped for setting and getting the value using component
> specification in .page file.
> I want to set the value for each component rendered so it should happen in the
> loop.
> I have a setter method to set the value for that....i.e. setStatus(String str)
> 
> I am not able to pre-set different values for each one of them.
> 
> How can i do that?
> 
> Thanks,
> Harsh
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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