Thanks for the help, It worked . Here is the code snippet of my working 
code..

.page
<table border="0" cellpadding="0" cellspacing="0" class="styledTable" 
 jwcid="[EMAIL PROTECTED]:FormTable" 
source="ognl:Offices" 
 convertor="ognl:dataItemConvertor" 
columns="selected,officeName,supervisor,parentOffice,facId,facName" 
rowsClass="ognl:beans.evenOdd.next"
pageSize="10"
 keyExpression="officeName" 
initialSortColumn="officeName" > 
<span jwcid="[EMAIL PROTECTED]"> 
<a jwcid="@DirectLink" listener="ognl:listeners.viewOffice" 
parameters="ognl:components.table.tableRow.officeName"> <span 
jwcid="@Insert" value="ognl:components.table.tableRow.officeName"/></a> 
</span> 
<span jwcid="[EMAIL PROTECTED]">
<span jwcid="[EMAIL PROTECTED]" value="ognl:
components.table.tableRow.selected" /> 
</span>
</table> 

.java
private IPrimaryKeyConvertor m_dataItemConvertor;
public OfficeList() {
super();
// define a IPrimaryKeyConvertor that gets DataItems from the original
// list
m_dataItemConvertor = new IPrimaryKeyConvertor() {
public Object getPrimaryKey(Object objValue) {
Office dataItem = (Office) objValue;
return dataItem.getOfficeName();
}

public Object getValue(Object objPrimaryKey) {
String offName = (String) objPrimaryKey;
List list = getOffices();

// find the item
int count = list.size();
for (int i = 0; i < count; i++) {
Office item = (Office) list.get(i);
if (item.getOfficeName().equals(offName)) {
return item;
}
}
return new Office(); // Handle data item not found
}
};

}


On 8/29/05, Mind Bridge <[EMAIL PROTECTED]> wrote:
> 
> Hi,
> 
> Try adding the following parameter to your Table component:
> 
> keyExpression="officeName"
> 
> Does it work?
> 
> (I guess it is high time to get the documentation checked in...)
> 
> 
> Somu Chandra wrote:
> 
> >Hello,
> > I am using tapestry 4 beta-5 for my application. I have Checkboxes
> >in my contrib table which I am trying to update.
> >Upon submission of the form I do not see any of the checkboxes being
> >selected in my java code.
> >
> >I tried printing out the object ID's for the Offices. I noticed that
> >it is the same before and after submission of the page.
> > Also I noticed the checkboxes are set to selected on a different set
> >of offices which I don't have control of.
> >
> >Any help is appreciated.
> >
> >.html
> > <form jwcid="@Form">
> > <div>
> > <table border="0" cellpadding="0" cellspacing="0" class="styledTable"
> > jwcid="[EMAIL PROTECTED]:Table"
> > source="ognl:offices"
> > columns="selected,officeName,supervisor,parentOffice,facId,facName"
> > rowsClass="ognl:beans.evenOdd.next"
> > pageSize="10"
> > initialSortColumn="officeName" >
> > <span jwcid="[EMAIL PROTECTED]">
> > <input type="Checkbox" jwcid="@Checkbox"
> >value="ognl:components.table.tableRow.selected" />
> > </span>
> > </table>
> >
> > </div>
> > <fieldset>
> > <input name="Submit" type="submit" value="Remove Facility"
> >jwcid="@Submit" listener="ognl:listeners.onRemoveOffices"/>
> > </fieldset>
> > </form>
> >
> >
> >.page
> ><property name="offices" persist="session"></property>
> ><bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>
> >
> >.java
> >
> > public abstract void setOffices(List Offices);
> >
> > public abstract List getOffices();
> >
> > public void onRemoveOffices(IRequestCycle cycle) {
> > List Offices = getOffices();
> > Iterator OfficesIterator = Offices.iterator();
> >
> > while (OfficesIterator.hasNext()) {
> > Office office = (Office) OfficesIterator.next();
> > if (office.isSelected()) {
> >// Control does not come to this block Even if the Checboxes are selected
> > office.setSelected(false);
> > OfficesIterator.remove();
> > }
> > }
> > }
> >
> >
> >
> >Office.java
> > private boolean selected ;
> >
> > public boolean isSelected() {
> > return selected;
> > }
> >
> > public void setSelected(boolean selected) {
> >// This gets printed for a different set of Offices
> >System.out.println("OfficeName --> "+ officeName +" Selected --> "+
> >selected + " Address -->"+ this);
> > this.selected = selected;
> > }
> >
> >
> >
> >
> >
> >
> >Thanks,
> >Somu Chandra
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to