In my example, the number of rows for Primefaces dataGridwas set to 5, and the columns were set to 2. The table shows 6 items.
This basically went unnoticed until we realized that the button on the 6th element does not work - most likely because it was not associated with the event?
As a minimal example, with XHTML (not showing elements h:head, etc.):
<h:body>
<h:form>
<p:dataGrid value="#{testBean.theStrings}" var="theString" rows="5" columns="2">
<p:commandButton action="#{testBean.printOut(theString)}" value="#{theString}"/>
</p:dataGrid>
</h:form>
</h:body>
And bean support
@ManagedBean
@SessionScoped
public class TestBean implements Serializable
{
private List<String> theStrings;
@PostConstruct
public void setup() {
System.out.println("Setting up array");
theStrings = new ArrayList<>();
for (int i = 0; i < 6; i++) {
theStrings.add(String.valueOf(i));
}
}
public List<String> getTheStrings()
{
return theStrings;
}
public void printOut(String theString) {
System.out.println(theString);
}
}
This will display 6 buttons labeled 0-5, but only a button labeled 5 will not bring the system out of the system.
What's going on here? Should rows not limit the number of elements to 5? Increasing the number of lines to 6 does not change the visual output, but the final button starts working.