<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- We need a doctype to allow us to use special characters like &nbsp;
We use a "strict" DTD to make IE follow the alignment rules. -->
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd" xmlns:p="tapestry:parameter">
<body class="container">
<h3>Grid With Delete Column (1)</h3>
A table built with the Grid component, including only the Person columns we want, and adding a Delete column.<br/><br/>
To demonstrate a server-side error, try to delete a person whose First Name is <em>${GOOD_NAME}</em>.<br/>
<div class="eg">
<t:form t:id="deletables">
<t:errors globalOnly="true"/>
<t:grid source="persons" row="person" encoder="personEncoder" include="id,firstname,lastname,startdate" add="delete">
<p:deleteCell>
<t:checkbox t:id="delete" value="delete" />
<!-- We shadow each output-only with a hidden field to enable redisplay of the list exactly as it was submitted. -->
<t:hidden value="person.firstName" />
<t:hidden value="person.lastName" />
<t:hidden value="person.startDate" t:encoder="dateEncoder" />
<!-- If optimistic locking is not needed then comment out this next line. -->
<t:hidden value="person.version" />
</p:deleteCell>
</t:grid>
<t:submit/>
<t:eventlink event="refresh" class="btn btn-default">Refresh</t:eventlink>
</t:form>
</div>
This example works very much like the Editable Grid For Update example.<br/><br/>
References:
<a href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/components/Grid.html">Grid</a>,
<a href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/ValueEncoder.html">ValueEncoder</a>,
<a href="http://tapestry.apache.org/forms-and-validation.html">Forms and Validation</a>.<br/><br/>
<t:pagelink page="Index">Home</t:pagelink><br/><br/>
The source for IPersonFinderServiceLocal and @EJB is shown in the Session Beans and @EJB examples.<br/><br/>
<t:tabgroup>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/tables/GridWithDeleteColumn1.tml"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/tables/GridWithDeleteColumn1.java"/>
<t:sourcecodetab src="/web/src/main/resources/META-INF/assets/css/examples/plain.css"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/commons/FieldCopy.java"/>
<t:sourcecodetab src="/business/src/main/java/jumpstart/business/domain/person/Person.java"/>
</t:tabgroup>
</body>
</html>