ICEfaces : IF 4 - DataTable Conditional Row Messages
¶ DataTable Conditional Row MessagesDataTable supports 'supplementary' rows rendered on a condition; either at particular interval, before or after a column-value grouping, or based on the result of an application defined condition. 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 attachment of the FacesMessage to the component is merely to demonstrate the technique, and will not be covered in detail. ¶ Normal RowThe normal row will contain the columns (in this sample, 1 column) & components necessary to render our row objects. Note the binding. This is used later to retrieve the clientId during predicate evaluation, to check for associated FacesMessages.
¶ Supplementary RowThe supplementary row will contain the h:messages component needed to show the messages resulting from the components of our standard row. The for property of the message component should be the client id of the normal row component that may have attached messages. One h:message component is required per component. If h:messages doesn't have 'for' defined, it prints the messages of all components in this page.
¶ Predicate DefinitionThe predicate is an object with a single method, with a single object argument, in this case an integer row index, and determines if the row satisfies the condition. The predicate is also evaluated 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 advantage of this fact, and references the iterative, data-bound outputText component of the row to use its correctly indexed clientId to find any attached messages.
With these components, a whole range of row-level summary or description behaviours are possible, we hope this tutorial has given you some ideas of your own! ¶ Tutorial Source Code Downloads
Attachments:
|
| Copyright © 2016 ICEsoft Technologies, Canada Corp. |