myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From C├ędric Durmont <cdurm...@gmail.com>
Subject Re: [trinidad 1.2] <tr:table> docs, rowselection, sorting, pagenation, filtering?
Date Fri, 08 Jul 2011 10:26:08 GMT
Hi,

1/ I don't know of a good CollectionModel subclassing example. Anyway,
I never really had the need for it. If you need to load rows on demand
and such, you may as well subclass List

2/ Don't forget in your <tr:column> to set sortable="true" AND
sortProperty="someAttribute", where "someAttribute" is the property
name of the row object (NOT an EL) :
<tr:table var="order" value="#{myBean.orders}"...>
<tr:column sortable="true" sortProperty="date">  <!-- refers to
order.date . If myBean.orders is a List<Order>, then this will use
Order.getDate() to get the value for sorting-->
...

3/ This is tricky to find. It's a skinning feature. See
http://myfaces.apache.org/trinidad/devguide/skinning.html . You have
to define a subclass of ResourceBundle that provides an array of keys
and translations, like this :
public class Traduction extends ListResourceBundle
{

	@Override
	protected Object[][] getContents()
	{
		// TODO Auto-generated method stub
		return _CONTENTS;
	}
	static private final Object[][] _CONTENTS =
    {
      {"af_tableSelectMany.SELECT_COLUMN_HEADER", "change me !"},
      {"af_tableSelectOne.SELECT_COLUMN_HEADER", "change me !"},
    };
}
The trickiest part of it is that the keys are often not documented,
you have to scan the source code to find them...

4/ Again you should find all you ned in the skinning section
5/ Not that I know of. The 2 bars are rendered as two different html tables
6/ Sounds fine to me. I'd simply use a list and put the filtering
stuff in a bean, though. Unless you plan to componentize your filtered
table

Regards,
Cedric Durmont

2011/7/8 Me Self <wmsopou@gmail.com>:
> I have a few questions about the trinidad table component. Hope
> someone can answer at least some of them..
>
> 1) I havent found much documentation other than
> http://myfaces.apache.org/trinidad/devguide/table.html. Is there any
> ADF documentation that would be usefull or is the trinidad version too
> different from the ADF one? In particular Im interested in
> documentation on how to use/subclass CollectionModel.
>
> 2) Sorting: The MyFaces 1.2 book from packt mentions that sorting is
> supported simply by using a List with beans with fields that implement
> Comparable and setting <tr:column sorting="true">. This dosent work
> for me. Is direct use of CollectionModel required to enable sorting?
>
> 3) Im using rowSelection="multiple". This adds a column with the
> header title "Select". All other text values in the table are backed
> by i18n bundle files. How do I override the default title of the row
> selection column with text from a bundle file?
>
> 4) Nobody I have talked to get the meaning of the "select all" "select
> none" icons above the row selection column. Is there any way to
> override the default icons with text links/buttons or other icons?
>
> 5) The table seems to operate with two control bars. In the top
> control bar I get the pagenation buttons (prev, next, dropdown with
> pagenumbers) and in the sub control bar I get the "select all"/"select
> none" icons. Is there any way to put them on the same line because it
> looks wierd that pagenations buttons are dangling far to the right
> with lots of space between them and the table?
>
> 6) Im planning to add my own filter buttons to the action facet and
> implement a CollectionModel where I can return rows based on the
> selected filters. When the user presses a filter button im going to
> update the model using ajax. Does that sound like standard way of
> doing or are there better options?
>

Mime
View raw message