Hi,
I'm using implementation of PaginatedList with displayTag and I have some problems to set initial sorting order for column.
By default param 'dir' in header's URL is set to 'asc' and setting 'defaultOrder' to 'descending' in column declaration das not change a thing, parameter 'defaultOrder' seems to be ignored for paginated lists.
Is it a bug or maybe I'm doing something wrong?
I've checked the source code and in HtmlTableWriter.getSortingHref() for paginatedList dirParam is always set to 'asc' (defaulOrder param is not taken under consideration):
<code>
if (headerCell.isAlreadySorted())
{
dirParam = tableModel.isSortOrderAscending() ? properties.getPaginationDescValue() : properties
.getPaginationAscValue();
}
else
{
dirParam = properties.getPaginationAscValue();
}
</code>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, I was wrong... Message from gandalf (forysiak) seems correct...
This works fine for me:
else {
//dirParam = properties.getPaginationAscValue();
dirParam = tableModel.isSortOrderAscending() ? properties.getPaginationDescValue() : properties
.getPaginationAscValue();
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm using implementation of PaginatedList with displayTag and I have some problems to set initial sorting order for column.
By default param 'dir' in header's URL is set to 'asc' and setting 'defaultOrder' to 'descending' in column declaration das not change a thing, parameter 'defaultOrder' seems to be ignored for paginated lists.
Is it a bug or maybe I'm doing something wrong?
I've checked the source code and in HtmlTableWriter.getSortingHref() for paginatedList dirParam is always set to 'asc' (defaulOrder param is not taken under consideration):
<code>
if (headerCell.isAlreadySorted())
{
dirParam = tableModel.isSortOrderAscending() ? properties.getPaginationDescValue() : properties
.getPaginationAscValue();
}
else
{
dirParam = properties.getPaginationAscValue();
}
</code>
Sorry, I was wrong... Message from gandalf (forysiak) seems correct...
This works fine for me:
else {
//dirParam = properties.getPaginationAscValue();
dirParam = tableModel.isSortOrderAscending() ? properties.getPaginationDescValue() : properties
.getPaginationAscValue();
I believe this is a bug in TableTag class, see last statement this.tableModel.setSortOrderAscending(direction == SortOrderEnum.ASCENDING);