You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Wyder, Michael (GMX)" <mi...@gmx.ch> on 2007/06/09 00:13:53 UTC
problems with sort in tomahawk datatable
Hi
I have 2 jsp's. Page A is the list which can be sorted, the other page B
is a detail page who shows detail of one entry from page A. My problem
is, that the choosen sort is not preserved: I do some sort on page A,
then i navigate to page B. Afterthat i navigate back to page A and i see
that the sort of the list is reseted to the default sort. Any ideas?
Both pages are backed by the same bean, which has session scope.
I made some debug and saw, that the entries in the DataModel in the
backing bean never change its order, even if i do some sort.
Here the declaration of the datatable:
<t:dataTable
var="address"
value="#{adresseServiceBean.addresses}"
sortable="true"
sortColumn="#{adresseServiceBean.sortColumn}"
sortAscending="#{adresseServiceBean.sortAscending}"
preserveSort="true"
renderedIfEmpty="false">
Thanks for help!
Michael
Re: problems with sort in tomahawk datatable
Posted by "Wyder, Michael (GMX)" <mi...@gmx.ch>.
Got it!!
I had to replace the type of the model in the backing bean this way:
addresses = new ListDataModel(); // part of the JSF-API
by
addresses = new SortableModel(); // from tomahawk-lib
Thanks anyway for help, Michael
Andrew Robinson schrieb:
> "Then i post back to page A"
>
> Add a Thread.currentThread().dumpStackTrace() in the set method of
> your sort property, perhaps that will shed more light.
>
> FYI, I always write my own sort code and don't rely on the component
> to sort (only to notify me when the user clicks on the header), so if
> you are letting the component auto-sort your data, that could be a
> completely different issue.
>
> On 6/10/07, Wyder, Michael (GMX) <mi...@gmx.ch> wrote:
>> Unfortunately this suggestion didn't solve the problem.
>>
>> To better describe my problem:
>>
>> Page A has the following content (natural order):
>> Id Name
>> -- ----
>> 1 Ziggy
>> 2 Aaron
>>
>> Then i sort the content by "Name":
>> Id Name
>> -- ----
>> 2 Aaron
>> 1 Ziggy
>>
>> Afterthat i choose for example the row with Id 2 to show the details
>> (page B). Then i post back to page A. In this page i expect that the
>> content is still ordered by "Name". But thats not the case, the content
>> is displayed in the "natural" order (by Id) again.
>>
>> Do you habe any ideas for this behavoir. Page A and Page B are backed by
>> the same bean which has session scope (the content is not reloaded after
>> during the request from page A to B and inverse).
>>
>> Michael
>>
>>
>>
>> Andrew Robinson schrieb:
>> > Set preserveSort to false as that will make the component attempt to
>> > store the sort state instead of letting the backing bean (in this
>> > case) store it.
>> >
>> > On 6/8/07, Wyder, Michael (GMX) <mi...@gmx.ch> wrote:
>> >> Hi
>> >>
>> >> I have 2 jsp's. Page A is the list which can be sorted, the other
>> page B
>> >> is a detail page who shows detail of one entry from page A. My problem
>> >> is, that the choosen sort is not preserved: I do some sort on page A,
>> >> then i navigate to page B. Afterthat i navigate back to page A and
>> i see
>> >> that the sort of the list is reseted to the default sort. Any ideas?
>> >> Both pages are backed by the same bean, which has session scope.
>> >>
>> >> I made some debug and saw, that the entries in the DataModel in the
>> >> backing bean never change its order, even if i do some sort.
>> >>
>> >> Here the declaration of the datatable:
>> >>
>> >> <t:dataTable
>> >> var="address"
>> >> value="#{adresseServiceBean.addresses}"
>> >> sortable="true"
>> >> sortColumn="#{adresseServiceBean.sortColumn}"
>> >> sortAscending="#{adresseServiceBean.sortAscending}"
>> >> preserveSort="true"
>> >> renderedIfEmpty="false">
>> >>
>> >> Thanks for help!
>> >> Michael
>> >>
>> >
>>
>
Re: problems with sort in tomahawk datatable
Posted by Andrew Robinson <an...@gmail.com>.
"Then i post back to page A"
Add a Thread.currentThread().dumpStackTrace() in the set method of
your sort property, perhaps that will shed more light.
FYI, I always write my own sort code and don't rely on the component
to sort (only to notify me when the user clicks on the header), so if
you are letting the component auto-sort your data, that could be a
completely different issue.
On 6/10/07, Wyder, Michael (GMX) <mi...@gmx.ch> wrote:
> Unfortunately this suggestion didn't solve the problem.
>
> To better describe my problem:
>
> Page A has the following content (natural order):
> Id Name
> -- ----
> 1 Ziggy
> 2 Aaron
>
> Then i sort the content by "Name":
> Id Name
> -- ----
> 2 Aaron
> 1 Ziggy
>
> Afterthat i choose for example the row with Id 2 to show the details
> (page B). Then i post back to page A. In this page i expect that the
> content is still ordered by "Name". But thats not the case, the content
> is displayed in the "natural" order (by Id) again.
>
> Do you habe any ideas for this behavoir. Page A and Page B are backed by
> the same bean which has session scope (the content is not reloaded after
> during the request from page A to B and inverse).
>
> Michael
>
>
>
> Andrew Robinson schrieb:
> > Set preserveSort to false as that will make the component attempt to
> > store the sort state instead of letting the backing bean (in this
> > case) store it.
> >
> > On 6/8/07, Wyder, Michael (GMX) <mi...@gmx.ch> wrote:
> >> Hi
> >>
> >> I have 2 jsp's. Page A is the list which can be sorted, the other page B
> >> is a detail page who shows detail of one entry from page A. My problem
> >> is, that the choosen sort is not preserved: I do some sort on page A,
> >> then i navigate to page B. Afterthat i navigate back to page A and i see
> >> that the sort of the list is reseted to the default sort. Any ideas?
> >> Both pages are backed by the same bean, which has session scope.
> >>
> >> I made some debug and saw, that the entries in the DataModel in the
> >> backing bean never change its order, even if i do some sort.
> >>
> >> Here the declaration of the datatable:
> >>
> >> <t:dataTable
> >> var="address"
> >> value="#{adresseServiceBean.addresses}"
> >> sortable="true"
> >> sortColumn="#{adresseServiceBean.sortColumn}"
> >> sortAscending="#{adresseServiceBean.sortAscending}"
> >> preserveSort="true"
> >> renderedIfEmpty="false">
> >>
> >> Thanks for help!
> >> Michael
> >>
> >
>
Re: problems with sort in tomahawk datatable
Posted by "Wyder, Michael (GMX)" <mi...@gmx.ch>.
Unfortunately this suggestion didn't solve the problem.
To better describe my problem:
Page A has the following content (natural order):
Id Name
-- ----
1 Ziggy
2 Aaron
Then i sort the content by "Name":
Id Name
-- ----
2 Aaron
1 Ziggy
Afterthat i choose for example the row with Id 2 to show the details
(page B). Then i post back to page A. In this page i expect that the
content is still ordered by "Name". But thats not the case, the content
is displayed in the "natural" order (by Id) again.
Do you habe any ideas for this behavoir. Page A and Page B are backed by
the same bean which has session scope (the content is not reloaded after
during the request from page A to B and inverse).
Michael
Andrew Robinson schrieb:
> Set preserveSort to false as that will make the component attempt to
> store the sort state instead of letting the backing bean (in this
> case) store it.
>
> On 6/8/07, Wyder, Michael (GMX) <mi...@gmx.ch> wrote:
>> Hi
>>
>> I have 2 jsp's. Page A is the list which can be sorted, the other page B
>> is a detail page who shows detail of one entry from page A. My problem
>> is, that the choosen sort is not preserved: I do some sort on page A,
>> then i navigate to page B. Afterthat i navigate back to page A and i see
>> that the sort of the list is reseted to the default sort. Any ideas?
>> Both pages are backed by the same bean, which has session scope.
>>
>> I made some debug and saw, that the entries in the DataModel in the
>> backing bean never change its order, even if i do some sort.
>>
>> Here the declaration of the datatable:
>>
>> <t:dataTable
>> var="address"
>> value="#{adresseServiceBean.addresses}"
>> sortable="true"
>> sortColumn="#{adresseServiceBean.sortColumn}"
>> sortAscending="#{adresseServiceBean.sortAscending}"
>> preserveSort="true"
>> renderedIfEmpty="false">
>>
>> Thanks for help!
>> Michael
>>
>
Re: problems with sort in tomahawk datatable
Posted by Andrew Robinson <an...@gmail.com>.
Set preserveSort to false as that will make the component attempt to
store the sort state instead of letting the backing bean (in this
case) store it.
On 6/8/07, Wyder, Michael (GMX) <mi...@gmx.ch> wrote:
> Hi
>
> I have 2 jsp's. Page A is the list which can be sorted, the other page B
> is a detail page who shows detail of one entry from page A. My problem
> is, that the choosen sort is not preserved: I do some sort on page A,
> then i navigate to page B. Afterthat i navigate back to page A and i see
> that the sort of the list is reseted to the default sort. Any ideas?
> Both pages are backed by the same bean, which has session scope.
>
> I made some debug and saw, that the entries in the DataModel in the
> backing bean never change its order, even if i do some sort.
>
> Here the declaration of the datatable:
>
> <t:dataTable
> var="address"
> value="#{adresseServiceBean.addresses}"
> sortable="true"
> sortColumn="#{adresseServiceBean.sortColumn}"
> sortAscending="#{adresseServiceBean.sortAscending}"
> preserveSort="true"
> renderedIfEmpty="false">
>
> Thanks for help!
> Michael
>