webtier@glassfish.java.net

Re: [webtier] Conditionally rendering h:column

From: Martin Beránek <martin.beranek_at_i.cz>
Date: Thu, 12 Nov 2009 22:27:30 +0100

I am not sure, but I guess that column rendered parameter is evaluated before table component start iterating over data. The whole mechanism of rendering dataTable is not to iterate over data and let colum tag render tags. Imagine column to be like facet. Correct me if i am wrong, but in jsf 1.2 it works like this...


Martin

Dne Čt 12. listopadu 2009 22:03:34 Uwe Seimet napsal(a):
> Hi Alex,
>
> > You have to think of it in terms of how an HTML table is drawn, you
> > cannot have a variable number of columns per row. If you have a dataset
> > of 5 rows, and you're deciding the rendered attribute of h:column using
> > data from the row item where it is not rendered in one row only, you'll
> > be generating mal-formed HTML:
> >
> > <table>
> > <tr><td>1</td><td>2</td</tr>
> > <tr><td>1</td><td>2</td</tr>
> > <tr><td>1</td><td>2</td</tr>
> > <tr><td>1</td><td>2</td</tr>
> > <tr><td>1</td>
> > </table>
> >
> >
> > Your condition for the rendered attribute of h:column can of course come
> > from anywhere, but it must be true for your entire dataset (and as such,
> > probably should not be derived from your iterated table data)
>
> I see your point, and there is indeed the potential of generating
> illegal HTML. In my case, however, the number of rendered columns was
> constant while rendering the table. Nevertheless the rendered result
> was incorrect. Provided that the count of rendered columns does not
> change while rendering a particular table (i.e. #{item.rendered} always
> returning the same value) I would have expected my code to work, but
> despite the fact that #{item.rendered} always returned 'true' the table
> was rendered incorrectly. I wonder why this happens and whether there is
> a technical explanation.
>
> Best regards
>
> Uwe
>
>