dev@javaserverfaces.java.net

Re: DataTable components

From: Drayton Brown <draytonbrown_at_gmail.com>
Date: Thu, 27 May 2010 14:17:56 +0100

Hi all

Thanks for the response, Raymond!

On 27 May 2010 05:30, Raymond DeCampo <ray_at_decampo.org> wrote:

> On Wed, May 26, 2010 at 8:05 AM, Drayton Brown <draytonbrown_at_gmail.com>wrote:
>
>> So I guess the sort of information I'm looking for is
>> 1) Are there any other reasons for defining a datatable using columns
>> besides the limitations on the foreach core component?
>>
>
> I'm speculating here, but the answer is almost certainly yes as the
> dataTable component pre-dates the ability to make custom components by
> composition, which was introduced in JSF 2.0.
>
> For my money, the way that dataTable is implemented/designed is a natural
> outgrowth of the way tables are specified in HTML.
>

I'm not so sure of this since HTML makes use of table rows (<tr>), and
cells (<td>) to specify a table. There is no column tag for a table in HTML.


>
>> 2) If the answer the question 1 is no, then were there any reasons for not
>> developing a new data iterator which returned subsets of data?
>>
>
> I imagine the answer here is that there is no perceived need for it. I'm
> not seeing the connection between such functionality and clickable rows.
> Furthermore you could write your own implementation of DataModel which might
> get you what you need, but I'm not really sure what that is, so maybe not.
>
>
The connection is that I believe the reason why the data table was
implemented using a columns approach is because having only a foreach
component, which returned single items off the list, meant that the people
implementing the data table could only get at the data a column entry at a
time.

If we had an alternative to the foreach component that could return a subset
of data from the list at a time (ie a rows' worth of data) then we could
implement a data table by defining what a row looks like (and then what each
cell in the row would look like, if we wanted to get that detailed). This
means that we would have a row component where we could add event listeners
like the 'onClick' event. Also this would more closely match the HTML
approach to defining tables, which is more intuitive and is better from a
logical layout point of view.

Currently there is no way to specify an 'onClick' event for a row, instead
one has to embed a component which can process an action in the table and
then use the action method with the DataModel to access the current row.
I find this messy and non intuitive since it adds extra components and
forces the user to think in terms of columns instead of the natural approach
of rows.


>
>>
>> I've checked out the JSF code from SVN, and I've been looking at the
>> foreach component code (although I cannot get it to compile yet).
>> I was thinking of implementing a ForEachSet component, but I do not want
>> to get into it if there are other reasons for not doing it.
>>
>>
I hope this makes my case clearer, as I still feel I've missed something.

Regards
Drayton
-- 
http://www.facebook.com/DraytonBrown