How to display different input type in one column

View: New views
3 Messages — Rating Filter:   Alert me  

How to display different input type in one column

by rtow :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

I have a column that needs to display either dropDownChoice or text.

dataViewPanel.html
          <tr wicket:id="datatable">
            <td>
                       
            </td>
            <td>
                        <input type="text" wicket:id="value" />
             </td>
          </tr>
        </table>

dataView.java
        protected void populateItem(Item item)
        {
                Config gc = (Config) item.getModelObject();
                item.setModel(new CompoundPropertyModel(gc));
               
                item.add(new Label("name"));
                item.add(new TextField("value"));
        }

My question is: depends on value of "name", I like to render the "value" column as either dropDownChoice or text.

thanks,
richard

Re: How to display different input type in one column

by igor.vaynberg :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

you need to create two fragments - one with markup for a textfield, and one
with markup for a dropdown. then add the appropriate fragment.

-igor


On 8/7/07, rtow <rtow@...> wrote:

>
>
> I have a column that needs to display either dropDownChoice or text.
>
> dataViewPanel.html
>           <tr wicket:id="datatable">
>             <td>
>
>             </td>
>             <td>
>                         <input type="text" wicket:id="value" />
>              </td>
>           </tr>
>         </table>
>
> dataView.java
>         protected void populateItem(Item item)
>         {
>                 Config gc = (Config) item.getModelObject();
>                 item.setModel(new CompoundPropertyModel(gc));
>
>                 item.add(new Label("name"));
>                 item.add(new TextField("value"));
>         }
>
> My question is: depends on value of "name", I like to render the "value"
> column as either dropDownChoice or text.
>
> thanks,
> richard
> --
> View this message in context:
> http://www.nabble.com/How-to-display-different-input-type-in-one-column-tf4234287.html#a12047116
> Sent from the Wicket - User (OLD) mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> IMPORTANT NOTICE:
>
> This mailing list is shutting down. Please subscribe to the Apache Wicket
> user list. Send a message to: "users-subscribe at wicket.apache.org" and
> follow the instructions.
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@...
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
IMPORTANT NOTICE:

This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: "users-subscribe at wicket.apache.org" and follow the instructions.
_______________________________________________
Wicket-user mailing list
Wicket-user@...
https://lists.sourceforge.net/lists/listinfo/wicket-user

Re: How to display different input type in one column

by newbie_to_wicket :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message






dropdown.html

<wicket:panel>
<select wicket:id="value">

</select>

</wicket:panel>

dropdown.java
DropDownChoice dp  = new DropDownChoice("value",.....);

add(dp);

textfieldpanel.html

textfieldpanel.java
TextField tf   = new TextField("value",,............);
add(tf)

where your are displaying (main html)


main java

if(... your condition)
{

DropDown dp  = new DropDown("value",...);
item.add(dp);

}

else{
TextFieldPanel tf =  new TextFieldPanel("value",..);
item.add(tf);

}





LightInTheBox - Buy quality products at wholesale price