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.

   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.

   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.

Neal Haggard
Senior System Developer
SAS Institute  

-----Original Message-----
From: Broekelmann, Mathias [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 12, 2005 3:29 AM
To: MyFaces Development
Subject: RE: Proposed improvement to x:dataTable

Hi Sean,

Take a look at the new component x:columns and the example crosstable.
I think it is exactly what you need to create a datatable with variable columns.
I've allready posted an example how to use it but I will post it again:

<x:dataTable value="#{data.rows}" var="row" >
  <!-- just a column -->
  <h:column>
    <f:facet name="header">
        <h:outputText value="fixed column" />
    </f:facet>
    <h:outputText value="#{row.attributeName}" />
  </h:column>
  <!-- new columns component renders a column for each element in data.columns 
-->
  <x:columns value="#{data.columns}" var="column">
    <f:facet name="header">
        <!-- row is not available! -->
        <h:outputText value="#{column.label}" />
    </f:facet>
    <!-- row is also available -->
    <h:outputText value="#{data.columnValue}" />
    <f:facet name="footer">
        <!-- row is not available! -->
        <h:outputText value="#{column.footer}" />
    </f:facet>
  </x:columns>
</x:dataTable>

We use this component in our application and it works very well. All what you 
need is to use DataModel for the data.rows and data.columns property. You can 
determine the current row and column in the method data.columnValue through 
data.rows.rowData and data.columns.rowData (which contains the current column 
of course). 

Hope that will help.

Mathias


> -----Original Message-----
> From: Sean Schofield [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 11, 2005 8:06 PM
> To: MyFaces Development
> Subject: Proposed improvement to x:dataTable
> 
> 
> We're trying to use x:dataTable in a project for work right now. 
> There are a few limitations that I would like to address with the 
> group's approval.
> 
> The main problem we're having is that you cannot have an open-ended 
> list of columns in your data.  Specifically, in our application we 
> have a feature where user's can build their own SQL queries and 
> generate custom reports.  We display the reports in a table now but we
> don' t have the sort or page functionality of x:dataTable.   We can't
> use x:dataTable as is b/c we don't know how many columns there are in 
> advance (or what name to give the header.)
> 
> I'd like to add a few additional attributes to x:dataTable that would 
> allow you to specify value binding expressions for determining the 
> names of the column headers along with which facet to use for which 
> column type.  Everything would work as before so this is just extra 
> functionality.  If there aren't any objections I would like to add the 
> functionality and a simple example for people to look at.  If there 
> are problems with it (or improvements) then we can back out the 
> changes or make further changes.  I think the idea is easier to 
> explain with actual code.
> 
> Please let me know if you have a problem with this approach.
> 
> sean
> 

Reply via email to