Hmmm...

It does look odd, right...

If you include it in the header or the column-body, it would be even
more odd, though, cause then you would have to take special
precautions for rendering.

Don't see another solution here, except to add the attribute on the
column itself.

regards,

Martin

On 12/21/05, Simon Kitching <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm using MyFaces from SVN head, and JSP to generate HTML.
>
> I need to be able to set the width for various columns on the table, and
> adding styles to each cell isn't sufficient - I need the COL tag
> functionality.
>
> As far as I can see, none of the table components available can generate
> COL html elements. Is this correct?
>
>
> I'm working on a patch to add this functionality. It involves
> modifications to HtmlTableRenderer, called just after <TABLE> has been
> emitted. My current code iterates over all child UIColumn components of
> the HtmlDataTable:
>
> * if child has a facet named "colstyle":
>     * emit a <COL span="n"> to match any preceding UIColumn that
>       didn't have this facet
>     * get the first child of that component and render it.
>
> This then allows:
>
>    <t:dataTable>
>      <t:column>...</t:column>
>      <t:column>...</t:column>
>      <t:column>
>        <f:facet name="header">
>           ...
>        </f:facet>
>        <f:facet name="colstyle">
>          <t:colstyle style="color:green" width="0*"/>
>        </f:facet>
>        <h:outputText value="test"/>
>      </t:column>
>    </t:dataTable>
>
> to generate
>
>    <TABLE>
>      <COL span="2">
>      <COL style="color:green" width="0*">
>      <THEAD>
>        <TR><TH>...</TH></TR>
>      <TBODY>
>        ....
>    </TABLE>
>
> There is something slightly odd about this use of facets though. In
> other cases, facets are used to hold arbitrary components that are
> rendered. Here, I'm really assuming the facet holds a component that
> generates a COL tag; anything else will result in a malformed page.
>
> Can anyone suggest an alternative way for columns to specify their COL
> data? Storing these attributes directly on the t:column tag isn't really
> practical I think.
>
> NB: I'll also handle UIColumns (ie t:columns) children but didn't want
> to confuse things further here...
>
> Cheers,
>
> Simon
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to