You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by DI Kurt Edegger <ed...@telbiomed.at> on 2006/10/25 12:19:59 UTC

Default sort of

Hi,

I'm using a sortable, paginated table in my application. Everything's 
working fine, except I'd like to set the default sorting of the table 
right, when the page is rendered.
Right now, the user has to click on a header field to determine her 
favored sorting.
Is there a way to specify the default sorting of a table? I've just 
found a way to set the default sort order of a column.

Any pointers appreciated!

Kurt

Re: Default sort of

Posted by DI Kurt Edegger <ed...@telbiomed.at>.
Ok, thank you a lot for your help and hints!

Enjoy, Kurt

Brian Smith schrieb:
> I have not tried what you are doing, but you not going to be able to 
> avoid a
> table binding.  You will have to call methods of the table directly in your
> backing bean to force this behavior.
> 
> On 10/25/06, DI Kurt Edegger <ed...@telbiomed.at> wrote:
>>
>> Sorry, but how do I call the setSortCriteria() method of the table?
>>
>> I do have a <tr:table value="#{pagedList}" var="task"/> in my xhtml file
>> and I'd love to avoid the need of using a binding to a table object.
>> The #{pagedList} returns a java.util.List and implements the required
>> methods for the table (getSortCriteria, setSortCriteria and isSortable),
>> but these methods are called automatically by myFaces.
>>
>> It seems like a common feature to me, but maybe I'm wrong...
>>
>> Regards, Kurt
>>
>> Brian Smith schrieb:
>> > Try using the setSortCriteria() method of the table.  If you have not
>> done
>> > this already, you will have to create a CoreTable object in your 
>> backing
>> > bean and bind it to the component using the binding attribute of the
>> > tr:table on the jsp.  Then after you fill the list, try setting the
>> > setSortCriteria(List criteria).   Each element of List criteria must be
>> of
>> > type SortCriterion.
>> >
>> > On 10/25/06, DI Kurt Edegger <ed...@telbiomed.at> wrote:
>> >>
>> >> Hi Brian,
>> >>
>> >> thank you for your fast response. The list is sorted already, but the
>> >> front-end doesn't show the nice little arrow to indicate that the
>> column
>> >> is sorted and sortable.
>> >> The sorting arrows (ascending/descending) will only show up after the
>> >> first click on a table header.
>> >>
>> >> I'd like to have the look and feel consistent, right after the page is
>> >> displayed.
>> >>
>> >> Any ideas?
>> >>
>> >> Regards, Kurt
>> >>
>> >> Brian Smith schrieb:
>> >> > Can't you just sort your list/array when you load it?  If this is
>> >> database
>> >> > data, just sort it in the query.
>> >> >
>> >>
>> >>
>> >
>>

Re: Default sort of

Posted by Brian Smith <un...@gmail.com>.
I have not tried what you are doing, but you not going to be able to avoid a
table binding.  You will have to call methods of the table directly in your
backing bean to force this behavior.

On 10/25/06, DI Kurt Edegger <ed...@telbiomed.at> wrote:
>
> Sorry, but how do I call the setSortCriteria() method of the table?
>
> I do have a <tr:table value="#{pagedList}" var="task"/> in my xhtml file
> and I'd love to avoid the need of using a binding to a table object.
> The #{pagedList} returns a java.util.List and implements the required
> methods for the table (getSortCriteria, setSortCriteria and isSortable),
> but these methods are called automatically by myFaces.
>
> It seems like a common feature to me, but maybe I'm wrong...
>
> Regards, Kurt
>
> Brian Smith schrieb:
> > Try using the setSortCriteria() method of the table.  If you have not
> done
> > this already, you will have to create a CoreTable object in your backing
> > bean and bind it to the component using the binding attribute of the
> > tr:table on the jsp.  Then after you fill the list, try setting the
> > setSortCriteria(List criteria).   Each element of List criteria must be
> of
> > type SortCriterion.
> >
> > On 10/25/06, DI Kurt Edegger <ed...@telbiomed.at> wrote:
> >>
> >> Hi Brian,
> >>
> >> thank you for your fast response. The list is sorted already, but the
> >> front-end doesn't show the nice little arrow to indicate that the
> column
> >> is sorted and sortable.
> >> The sorting arrows (ascending/descending) will only show up after the
> >> first click on a table header.
> >>
> >> I'd like to have the look and feel consistent, right after the page is
> >> displayed.
> >>
> >> Any ideas?
> >>
> >> Regards, Kurt
> >>
> >> Brian Smith schrieb:
> >> > Can't you just sort your list/array when you load it?  If this is
> >> database
> >> > data, just sort it in the query.
> >> >
> >>
> >>
> >
>
>
> --
> ===========================================
>
>    DI Kurt Edegger
>    ARC Seibersdorf research GmbH
>    Biomedical Engineering / eHealth systems
>
>    Reininghausstrasse 13/1
>    A-8020 Graz, Austria
>
>    T: +43 (0)316 586 570 - 58
>    F: +43 (0)316 586 570 - 12
>    E: kurt.edegger@arcsmed.at
>    H: www.arcsmed.at/ehs
>
> ===========================================
>

Re: Default sort of

Posted by DI Kurt Edegger <ed...@telbiomed.at>.
Sorry, but how do I call the setSortCriteria() method of the table?

I do have a <tr:table value="#{pagedList}" var="task"/> in my xhtml file 
and I'd love to avoid the need of using a binding to a table object.
The #{pagedList} returns a java.util.List and implements the required 
methods for the table (getSortCriteria, setSortCriteria and isSortable), 
but these methods are called automatically by myFaces.

It seems like a common feature to me, but maybe I'm wrong...

Regards, Kurt

Brian Smith schrieb:
> Try using the setSortCriteria() method of the table.  If you have not done
> this already, you will have to create a CoreTable object in your backing
> bean and bind it to the component using the binding attribute of the
> tr:table on the jsp.  Then after you fill the list, try setting the
> setSortCriteria(List criteria).   Each element of List criteria must be of
> type SortCriterion.
> 
> On 10/25/06, DI Kurt Edegger <ed...@telbiomed.at> wrote:
>>
>> Hi Brian,
>>
>> thank you for your fast response. The list is sorted already, but the
>> front-end doesn't show the nice little arrow to indicate that the column
>> is sorted and sortable.
>> The sorting arrows (ascending/descending) will only show up after the
>> first click on a table header.
>>
>> I'd like to have the look and feel consistent, right after the page is
>> displayed.
>>
>> Any ideas?
>>
>> Regards, Kurt
>>
>> Brian Smith schrieb:
>> > Can't you just sort your list/array when you load it?  If this is
>> database
>> > data, just sort it in the query.
>> >
>>
>>
> 


-- 
===========================================

   DI Kurt Edegger
   ARC Seibersdorf research GmbH
   Biomedical Engineering / eHealth systems

   Reininghausstrasse 13/1
   A-8020 Graz, Austria

   T: +43 (0)316 586 570 - 58
   F: +43 (0)316 586 570 - 12
   E: kurt.edegger@arcsmed.at
   H: www.arcsmed.at/ehs

===========================================

Re: Default sort of

Posted by Brian Smith <un...@gmail.com>.
Try using the setSortCriteria() method of the table.  If you have not done
this already, you will have to create a CoreTable object in your backing
bean and bind it to the component using the binding attribute of the
tr:table on the jsp.  Then after you fill the list, try setting the
setSortCriteria(List criteria).   Each element of List criteria must be of
type SortCriterion.

On 10/25/06, DI Kurt Edegger <ed...@telbiomed.at> wrote:
>
> Hi Brian,
>
> thank you for your fast response. The list is sorted already, but the
> front-end doesn't show the nice little arrow to indicate that the column
> is sorted and sortable.
> The sorting arrows (ascending/descending) will only show up after the
> first click on a table header.
>
> I'd like to have the look and feel consistent, right after the page is
> displayed.
>
> Any ideas?
>
> Regards, Kurt
>
> Brian Smith schrieb:
> > Can't you just sort your list/array when you load it?  If this is
> database
> > data, just sort it in the query.
> >
>
>

Re: Default sort of

Posted by DI Kurt Edegger <ed...@telbiomed.at>.
Hi Brian,

thank you for your fast response. The list is sorted already, but the 
front-end doesn't show the nice little arrow to indicate that the column 
is sorted and sortable.
The sorting arrows (ascending/descending) will only show up after the 
first click on a table header.

I'd like to have the look and feel consistent, right after the page is 
displayed.

Any ideas?

Regards, Kurt

Brian Smith schrieb:
> Can't you just sort your list/array when you load it?  If this is database
> data, just sort it in the query.
> 


Re: Default sort of

Posted by Brian Smith <un...@gmail.com>.
Can't you just sort your list/array when you load it?  If this is database
data, just sort it in the query.

On 10/25/06, DI Kurt Edegger <ed...@telbiomed.at> wrote:
>
> Hi,
>
> I'm using a sortable, paginated table in my application. Everything's
> working fine, except I'd like to set the default sorting of the table
> right, when the page is rendered.
> Right now, the user has to click on a header field to determine her
> favored sorting.
> Is there a way to specify the default sorting of a table? I've just
> found a way to set the default sort order of a column.
>
> Any pointers appreciated!
>
> Kurt
>