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.
The normal row will contain the columns / components nessescary to render our row objects.
The supplementary row will contain the h:messages component needed to show the messages resulting from the compnents of our standard row.
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.