Hi Neal,

> -----Original Message-----
> From: Neal Haggard [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 12, 2005 3:20 PM
> To: MyFaces Development
> Subject: RE: Proposed improvement to x:dataTable
>
>
> Mathias,
>
>    While your x:columns is very nice, it does not answer
> Sean's request to have something where the columns can be
> independently formatted.  All of your columns in x:columns
> must have the same output, so we can't have one column that
> provides a link to an outside source, or is otherwise
> dynamically rendered.

You can put everything into a columns component. I use the rendered
flag to switch the components defined in the jsp on or off. So
everything is defined in the
columns component (through includes of other jsps).

>
>    We also evaluated using x:columns and are on the road to
> writing our own custom table & column components to meet our
> user requirements.  Our users are wanting to be able to
> dynamically re-order the columns in the table, and pick and
> choose which ones to show.  We're currently planning on
> implementing this by having the JSP define all the possible
> columns, and specify on the column what index the columns
> should have (to specify column ordering, to be sorted &
> handled by our DataTable).  We're also adding a rendered
> attribute to the column, to allow columns to be shown/hidden
> as needed.

Our users do the same with the columns component. They choose the
columns they want and the content is rendered in depend of the
data which contains the column. How the content is rendered is defined
through one of the nested panelgroups inside the columns component.

>
>    If anyone has any ideas of how we can meet our user
> requirements with some available component out there, we'd
> love to hear about it.
>

Here is an example how we use the columns component:

Content of overview.jsp which shows the datatable

<x:dataTable rowClasses="data,data2" preserveDataModel="false"
styleClass="data" border="0" frame="box"
        value="#{overview.resourcesModel}" var="line" >
        <h:column rendered="#{overview.modifiable}">
                <f:facet name="header">
          <h:commandLink styleClass="hauptnav"
action="#{overview.create}">
            <h:graphicImage border="0" title="Erstellen"
              value="/public/images/admin/erstellen.gif" alt="Erstellen"
/>
          </h:commandLink>
                </f:facet>
                <h:commandLink styleClass="hauptnav"
action="#{overview.modify}">
                        <h:graphicImage border="0" title="Bearbeiten"
 
value="/public/images/admin/bearbeiten.gif" alt="Bearbeiten" />
                </h:commandLink>
        </h:column>
        <x:columns value="#{overview.attributes}" var="attr">
                <f:facet name="header">
                        <h:outputText value="#{attr.label}" />
                </f:facet>
               
               
                <!-- we use panelGroup to switch the rendering of
different content -->               
               
        <h:panelGroup rendered="#{attr.booleanType && attr.value !=
null}">
       
            <!-- show a boolean value through graphic images -->
           
            <h:graphicImage
url="/public/images/admin/activeCheckBox.gif"
              rendered="#{attr.value}" />
            <h:graphicImage
url="/public/images/admin/inactiveCheckBox.gif"
              rendered="#{!attr.value}" />
        </h:panelGroup>
        <h:panelGroup rendered="#{!attr.booleanType}">
       
            <!-- show other values through normal outputText -->
           
            <h:outputText value="#{attr.value}" />
        </h:panelGroup>
       
       
        </x:columns>
    <h:column rendered="false">
        <f:facet name="header">
              <h:commandLink value="..."
action="#{overview.selectAttributes}" />
        </f:facet>
  </h:column>
</p:dataTable>

Reply via email to