DataTable Conditional Row Messages

compared with
Version 4 by Nils Lundquist
on Apr 02, 2012 17:22.


Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 7 changes. View first change.

 DataTable supports 'supplementary' rows rendered on a condition; either at particular interval, before or after a column-value grouping, on based on the result of an application defined conditon. This tutorial demonstrates the last technique, defining a condition that renders the supplementary row following a row whose h:outputText component has an attached FacesMessage.
  
 We will cover the definition of the 'normal' row, 'supplementary' row and the predicate that determines row rendering based on FacesMessage presence.
  
 The attachement of the FacesMessage to the component is merely to demonstrate the technique, and will not be covered in detail.
  
  
  
 Normal Row
  h3. Normal Row
  
The normal row will contain the columns / components nessescary to render our row objects.
 {code}
  The normal row will contain the columns (in this sample, 1 column) & components nessescary to render our row objects.
  
 
 {code}
Supplementary Row
  <ace:column headerText="ID">
  <h:outputText id="idOutput" value="#{row.id}" binding="#{backing.idOutput}" />
 </ace:column>
 {code}
 h3. Supplementary Row
  
 The supplementary row will contain the h:messages component needed to show the messages resulting from the compnents of our standard row.
 {code}
 
  <ace:row condition="predicate" predicate="#{backing.predicate}">
 &nbsp;&nbsp; &nbsp;<ace:column>
 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <h:messages for="idOutput" style="font-size: 10pt; color:red; margin: 0.3em 0 0.5em 0;"/>
 &nbsp;&nbsp; &nbsp;</ace:column>
 </ace:row>
 {code}
Predicate Definition
  
 The predicate is a function that is passed an object, in this case an integer row index, and determines if the row satisfies the conditon. The predicate is also evaluted following iteration to the row index in question, so the request context variables are in sync with the correct row object. The predicate in this example takes example of this fact, and references the iterative, data-bound outputText component of the row to determine the presences of messages.
  h3. Predicate Definition
  
 The predicate is a function that is passed an object, in this case an integer row index, and determines if the row satisfies the conditon. The predicate is also evaluted following iteration to the row index in question, so the request context variables are in sync with the correct row object. The predicate in this example takes example of this fact, and references the iterative, data-bound outputText component of the row to use its clientId to find any attached messages.
 {code}
  
 {code}

© Copyright 2017 ICEsoft Technologies Canada Corp.