myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Broekelmann, Mathias" <MBroekelm...@PSI.DE>
Subject RE: Proposed improvement to x:dataTable
Date Tue, 12 Apr 2005 07:29:29 GMT
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:sean.schofield@gmail.com] 
> 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
> 

Mime
View raw message