This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am trying to display a collection of data in a table using Primefaces' p:dataGrid.
My data may have between 2 and 16 columns, with each column being displayed (as a graph) in a cell of the dataGrid.
I've written a composite component which takes a single attribute "number".
The cc creates several h:panelGroup items and a p:slider item with "id" attributes based on the passed in "number".
If I call the cc with a hardcoded attribute, it works as I expected.
However, when the cc is called from with a p:dataGrid, the dynamic passed parameter is used for "value" but not for "id".
Here is a simplified tester version of my composite component:
It contains 2 h:panelGroup elements, each with a h:outputText to display the passed attributes.
The first is my original version where the "id" is constructed on the fly.
The second uses an "id" value which was passed in.
Here is the view code with calls the cc:
I am calling the cc "graph" twice to illustrate the 2 behaviors I mentioned above.
The "layoutList" is being iterated through correctly, so the value of "leadNumber" for the first element is zero.
Here is the HTML which is generated:
As you can see, the div id is generated correctly when a literal "5" is passed (ContainerDiv5).
But when the number is dynamically passed from the "layoutList" variable as "0", the id is wrong (ContainerDiv instead of ContainerDiv0)
Can anyone tell me why these two cases behave differently?
Is there any way to have the number from my variable used to construct the div id within my compound component?