You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nalin Gupta <Na...@macquarie.com> on 2007/01/02 06:01:07 UTC

Contrib:table and with editable form

Hi ,
 
I am having an issue with a table within a form. I have a checkbox that
I use in every table row , however the field associated to the checkbox
does not remember whether it was checked or not in the listener method.
I am not sure why. I have tried various approaches , including setting
the orignal "source" List to Persist("session"), storing it in the Visit
object. 

I have looked through John Reynold's wonderful tutorial from
http://weblogs.java.net/blog/johnreynolds/archive/2004/10/tapestry_compo
n_1.html and have pretty much followed the examples given (although I
have modified it to use annotations and Tapestry 4.1 )

Maybe I am missing something obvious in the page lifecycle ?

Software : 
Tapestry 4.1.2-SNAPSHOT
Tomcat 5.0
JDK 1.5.0_07
 
I am using the contrib:table component to display the table and the
source contains a list of "Entity" objects :
 
Page class :
 @Persist("session")
 public abstract void setResultingEntities(List<Entity> entities);
 public abstract List<Entity> getResultingEntities();
 
	/* Listener method. */
 	public ILink deleteEntity(IRequestCycle cycle) {
		// process the list
		List<Entity> list = getResultingEntities();
		System.out.println("getResultingEntities size is
"+list.size());
		for (Entity object : list) {
			// ISDELETEREADY IS ALWAYS FALSE !!!
			System.out.println("checking " + object.getRid()
+ "--" + object.isDeleteReady() + "--"
					+ object.getEntityName());
			if (object.isDeleteReady()) {
				System.out.println("*** RID " +
object.getRid() + " is ready to be deleted !!!");
			}
		}
		// return Page ....

	}


Page HTML:
<form jwcid="@Form" listener="ognl:listeners.deleteEntity">
<table class="mytable"
jwcid="table@contrib:FormTable"
source="ognl:resultingEntities"
converter="ognl:entityCoverter"
persist="literal:client"
columns="!check::deleteReady,rid:RID:rid,entityName:Entity
Name:entityName,=typeColumn,=statusColumn,companyNumber:Company
Number:companyNumber,=cityColumn"
pageSize="50" >
<span jwcid="checkColumnValue@Block">
<span jwcid="toDelete@Checkbox"
value="ognl:components.table.tableRow.deleteReady"/>
</span>
</table>
<span jwcid="@Submit" protect="true" value="Delete Entity"
class="formfieldbtn" />
</form>

 

The deleteReady field is a boolean in the "Entity" class. I am expected
this to be set to true when the checkbox is checked and the submit
button pressed.

Thanks in advance for your help,
Nalin.


NOTICE
This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank.

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