You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by st...@wachovia.com on 2005/02/09 00:44:15 UTC

CheckBox inside TableView

I have a checkbox inside my tableView but the property for each object in 
the list is never being set upon form submission.

In the form listener, I iterate through the list, checking the property 
and perform some action based on whether or not the checkbox was checked.

Has anyone had a similar issue with checkboxes and the table component? It 
works fine using Foreach but not Table.


<component id="RestoreCheckBox" type="Checkbox">
        <binding name="selected" expression=
"currentMessage.restoreMessage"/>
    </component> 

<form jwcid="form">
        <table class="data" jwcid="tableView" border="1">
        <span jwcid="RestoreColumnHeader">&nbsp;</span>
        <span jwcid="RestoreColumnValue" align="center">
 
            Restore <span jwcid="RestoreCheckBox"/>
        </span>
         <caption>
        <span>&nbsp;</span> 
        </caption>
 
                <tr class="head">
                <th><span jwcid="messageType"/></th>
            <th>&nbsp;</th>
            <th>&nbsp;</th>
                <th>Current Count: <span jwcid="messageCountInsert"/></th>
            </tr> 
                <tr>
 
                        <tr class="head">
                                <th jwcid="tableColumns"/>
                        </tr>
                        <tr class="grid" jwcid="tableRows">
                                <td jwcid="tableValues" align="left"/>
                        </tr>
        </table>
        <span jwcid="restoreButton"/> 
    </form>

Re: CheckBox inside TableView

Posted by Sohail Aslam <so...@techlogix.com>.
steven.libonati@wachovia.com wrote:
> I have a checkbox inside my tableView but the property for each object in 
> the list is never being set upon form submission.
> 
> In the form listener, I iterate through the list, checking the property 
> and perform some action based on whether or not the checkbox was checked.
> 
> Has anyone had a similar issue with checkboxes and the table component? It 
> works fine using Foreach but not Table.

Here is an excerpt from a .page file that sets up a table with a 
"Select" column with check boxes. The checkbox is associated with the 
"item" object that makes up a row in the table. The "item" object has a 
boolean attribute "selected" with getter and setter. The scheme I used 
was essentially to get the row object from the table component and let 
the checkbox to drill down to the selected flag  and set it.

      <component id="select" type="Checkbox">
       <binding name="selected"
         expression="components.tableFormRows.tableRow.selected"/>
      </component>

      <component id="tableView" type="contrib:TableView">
          <binding name="source" expression="itemList"/>
          <binding name="columns">
            '!Select:selected,'+
            'ItemCode:Item Code:object.itemCode,'+
            'Description:Description:object.itemDesc'
          </binding>
          <binding name="initialSortColumn">"Description"</binding>
          <binding name="pageSize" expression="itemList.size"/>
      </component>

      <component id="tableColumns" type="contrib:TableColumns"/>
      <component id="tableFormRows" type="contrib:TableRows">
          <binding name="row" expression="item"/>
      </component>
      <component id="tableValues"  type="contrib:TableValues"/>

Regards,
Sohail Aslam
aslam at techlogix.com




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