Yay!!!! Thank you for making this happen. This is a basic need that users have talked to
me about in almost all UX conversations I have had so far!
----- Original Message -----
From: "Vojtech Szocs" <vszocs(a)redhat.com>
To: devel(a)ovirt.org
Sent: Tuesday, May 13, 2014 10:37:51 AM
Subject: [ovirt-devel] Sortable columns in UI
Hey guys,
oVirt UI has been missing column sort functionality for quite a while
now, but here's some good news.
I've just merged patch [1] that adds support for both server-side and
client-side sorting of table columns. This patch adds the necessary
infra/API; column sorting must be enabled per-column for given table,
just like with column resizing.
[1]
http://gerrit.ovirt.org/#/c/25910/
Currently, only TextColumnWithTooltip (and its subclasses) support
sorting, however this can easily be changed in future by having the
column class extend SortableColumn.
To enable sorting:
// Enables server-side sorting via search query
// ... SORTBY name ASC|DESC
column.makeSortable("name"); // consider using shared constant
-or-
// Enables client-side sorting using comparator
column.makeSortable(comparator);
In order for server-side sorting to work properly, corresponding
SearchableListModel must apply the search options while executing
"Search" query.
For example, in DataCenterListModel:
@Override
public boolean supportsServerSideSorting() {
// Default is false
return true;
}
@Override
protected void syncSearch() {
// Append "SORTBY" clause to search query
String search = applySortOptions(getSearchString());
...
}
If a model doesn't support server-side sorting, client-side sorting
will be used as fall back (assuming a comparator was provided).
In general, all main tab list models in WebAdmin utilize "Search"
query, so we can enable server-side sorting for columns that exist
within main tab tables.
As for sub tabs (whose list models generally don't use "Search"
query, but also don't support paging at the moment), these can
simply use client-side sorting, i.e. reuse existing comparators
defined in Linq class.
PS: I've attached a screenshot depicting sorted column in action.
Regards,
Vojtech
_______________________________________________
Devel mailing list
Devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel