You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Renzo Tomaselli <re...@tecnotp.it> on 2007/07/27 12:37:36 UTC
[Trinidad] sorting tr:table missing info
Hi, I'm a bit confused about how to prepare a tr:table for sorting.
First, I miss the rationale behind the sortProperty attribute. Since
visual appearance (and next action) occurs on a given column - which is
bound to a model property - why do we need to specify a further property
name to sort on ?
Then I noticed from a previous message that sortProperty does not accept
EL, just literal strings. In case of dynamic columns (I use c:forEach),
this should mean that I cannot sort on any column, since I cannot
specify a dynamic sortProperty name. Is that correct ? Is there any way
to shortcut sortProperty to the current column ?
Furthermore, could anybody please explain the usage of requested methods
isSortable, setSortCriteria, getSortCriteria ? I use my own Collection
model, which is presumed to export these methods to enable sorting, but
I miss any involved semantics.
There is nothing about on demos, wiki and general Trinidad documentation.
Re: [Trinidad] sorting tr:table missing info
Posted by Adam Winer <aw...@gmail.com>.
On 7/27/07, Renzo Tomaselli <re...@tecnotp.it> wrote:
> Hi, I'm a bit confused about how to prepare a tr:table for sorting.
> First, I miss the rationale behind the sortProperty attribute. Since
> visual appearance (and next action) occurs on a given column - which is
> bound to a model property - why do we need to specify a further property
> name to sort on ?
The column itself isn't really bound to a model property per se.
Components within it are, and might even be bound to multiple
properties, or bound in a weird way, etc.
sortProperty is used to create SortCriterion objects that can be
passed to the CollectionModel.setSortCriteria() method.
> Then I noticed from a previous message that sortProperty does not accept
> EL, just literal strings. In case of dynamic columns (I use c:forEach),
> this should mean that I cannot sort on any column, since I cannot
> specify a dynamic sortProperty name.
Dynamic sortProperty still works. It's just that your EL binding
is to a literal string.
The limitation here is just that you can't have:
<tr:column sortProperty="#{row.name.first}">
... and expect that to sort the first name.
Nor, if you're just using our default SortableModel wrapper
(which performs all sorting in-memory), can you use:
<tr:column sortProperty="name.first"/>
... but that's a limitation of SortableModel, not sortProperty.
Finally, the "sortable" property is there to turn off sorting
for a column. Removing sortProperty also does this,
but there are cases where you might want to dynamically
turn sorting on and off, and doing it via a sortable property
is clearer.
-- Adam
> Is that correct ? Is there any way
> to shortcut sortProperty to the current column ?
> Furthermore, could anybody please explain the usage of requested methods
> isSortable, setSortCriteria, getSortCriteria ? I use my own Collection
> model, which is presumed to export these methods to enable sorting, but
> I miss any involved semantics.
> There is nothing about on demos, wiki and general Trinidad documentation.
>
>