Reference » TaglibTable

TaglibTable

Last modified by Andreas Hahn on 2011/06/07 14:35


Selection016.png

table

Table tag is the entry-level tag for segment view specification. It provides 3 entry points for its fragments header, row and submission. see Source pagecode.png

fragments

tabHeader

In the tabHeader section all parts of a datagrids header are defined. It's usually build of <table:sort /> headers for simple sorting specification. 

tabRow

The tag iterates over the visible section of the tables rows. Each row will be rendered according to the definitions in tabRow. For each row rowVariables will be exposed. It's important to note that inside a tabRow fragment springs nested path is already set to the rowPath determined by the rowVariables. This allows for unqualified path names in your statements:

<spring:bind path="modelAttribute" />
<form:input path="modelAttribute" />

This formal explanation gets more obvious with the code examples in the usage section below and an ad hoc experience in the online OrderDemo

tabSubmission

In the tabSubmission section the 'save' and 'cancel' action have to be defined.
The default actions should usually be ok.

usage

show template pagecode.png Check these examples from OrderDemo: addresses pagecode.png customers pagecode.png items pagecode.png order items pagecode.png orders pagecode.png

For your small to midsize projects it is recommended you create a WEB-INF/tags/segments/tables folder and place all the projects datagrid definitions inside this folder. Each definition should get a .tagx suffix.

In the WEB-INF/tags/segments/segments.tagx all the datagrid definitions are wired together pagecode.png

blurInput

t.b.d.

chainRow

hlchainrow.png
see Source pagecode.png use in <table:tabRow /> fragments.

'Chain' the row with a subsequent segment:

<td>
   <table:chainRow chainName="addresses" code="addresses" />
</td>

Clicking the link will add a subsequent segment just below the current segment. In many cases (although this is not a requirement) the subsequent segment represents a 1:N relationship. The segment needs to be defined in segments.xml and the chainName-parameter refers to a chain defintion in chains.xml .

Parameters:

Parameter  O Usage
codeoptA default code for the chain symbol taken from the configured message resources
chainNameThe name of the chain definition
defaultTextoptA default text for the chain symbol
enabledoptset to true if chaining should be enforced even for transient or deleted rows
imageoptAn image relative to the defined ${images} base directory w/o leading slash

confirmDeleteRow

hldeleterow.png
see Source pagecode.png use in <table:tabRow /> fragments.

Delete the row from the database depending on the configured deletion action. 

<td>
   <table:confirmDeleteRow />
</td>

By default the actual underlying model object is deleted but if the model object implements the ModelDeletion lifcycle interface the object might just be marked as deleted. Its then up to the implementation to provide another suitable deletion strategy. Transient and already deleted rows are excluded from deletion. The deletion has to be confirmed by the user.

iconRow

hliconrow.png
see Source pagecode.png use in <table:tabRow /> fragments.

Show an icon representing the rows persistence state e.g. transient, persistent, deleted

<td>
   <table:iconRow />
</td>

info

hlinfo.png
see Source pagecode.png

Hovering the info icon shows information about the datagrids backing object

<td>
   <table:info />
</td>

Available information

  • Last update (read) from backing datasource
  • Current page / total page load 
  • Visible lines / total lines loaded / eof indicator ('+' denotes more data available)
  • Viewport size

navi

hlnavi.png
see Source pagecode.png

navigation controls for the datagrid

<td>
   <table:navi/>
</td>

rowVariables

This tag provides a couple of variables for each row within a datagrid which are exposed to the request context application code within <table:tabRow /> fragment. 

Parameters

 var  description
rowPath rowPath prefix suitable for building a fully qualified cell name you can use for html <input name="..." /> tags
rowPathId rowPathId prefix suitable for building a fully qualified cell id to be used by javascript and css
optionPathoptionPath suitable for referencing a user row selection when underlying model supports MultiChoice (default)
isTransient inspects the model row object and returns true for transient objects (when model object implements ModelCreation )
isDeleted inspects the model row object and returns true for deleted objects (when model object implements ModelDeletion )
rowClassDefault returns a html class id to allow stylesheet customization for row rendering ( sheptTableRow sheptTableNewRow sheptTableEvenRow sheptTableOddRow
rowStatus the rows bind status as delivered by springs <spring:bind /> tag
rowObject the rows underlying object as delivered by springs <spring:bind /> tag for directly rendering the row through el tags

Have a look at the source pagecode.png
As these variables are exposed by default to <table:tabRow /> fragements application code should not include the taglib directly.

 

size

hlsize.png
see Source pagecode.png

sizing controls for the datagrid

<td>
   <table:size/>
</td>

sort

hlsort.png
see Source pagecode.png use in <table:tabHeader /> fragments.

datagrid sorting

<th>
   <table:sort sortCol="firstName" code="firstName"/>
</th>

The effective sorting drills down to the underlying ScrollingListProvider capabilites and its page loading definitions. If all data rows have already been loaded completely sorting takes place in-memory by default. Implementations like the HibernateCriteriaListProviderImpl fully honor sort specifications and will provide sorting capabilities even for large datasets. 

Parameters

 var  O  description
sortCol an attribute name of the underlying entity model object of the row being sorted. Usually this will be the same as the datagrids row <spring:bind path="..." or <form:input path="..." /> path argument as defined in its matching <table:tabRow /> fragment.
pageHolderoptan alternate pageHolder (defaults to the segments form backing object)
codeoptmessage code for the column title
titleopttitle if code is absent (if title is absent 'sortCol' is displayed as a title)
imageDiroptalternate imageDir (default is images/pager)
imageExtoptalternate image extension for up/down sorting (default is .png)
imageSortoptname of the base image (default is arrows_sort) with (_up / _down postfix)
cssClassopta html class if this is not the sort column (default is shept_pager_nosort)
cssClassSortedopta html class if this is the sort column (default is shept_pager_sort)
disabledoptdisables sorting for this column

tableFooter

hltableFooter.png
see Source pagecode.png

convenient tableFooter to include </table:navi /> <table:size /> and <table:info />

<th>
   <table:tableFooter />
</th>
Tags:
Created by Andreas Hahn on 2011/05/22 17:14

© 2011 shept.org - Andreas Hahn