[Engine-devel] Sorting in tabs

Einav Cohen ecohen at redhat.com
Thu Jun 27 12:37:05 UTC 2013


> ----- Original Message -----
> From: "Eli Mesika" <emesika at redhat.com>
> Sent: Thursday, June 27, 2013 6:46:58 AM
> 
> 
> ----- Original Message -----
> > From: "Lior Vernia" <lvernia at redhat.com>
> > To: engine-devel at ovirt.org
> > Sent: Thursday, June 27, 2013 10:12:33 AM
> > Subject: [Engine-devel] Sorting in tabs
> > 
> > Hello everyone (UI peeps in particular),
> > 
> > I've pushed (not yet merged) a patch that would enable us to keep items
> > in tabs (main/sub) sorted at all times by setting a comparator in
> > SearchableListModel:
> 
> But tabs includes only 100 records and supports paging , how you deal with
> that ???

if this is in the GUI level, then I assume that the comparator is simply comparing the 
items within the current page, and not "globally".
so the sorting doesn't affect the set of items that is displayed in the page (it would 
be the same as before the sorting) - just their order.

e.g. if I have VMs named "e", "a", "c" in page 1 and "f", "b", "d" in page 2, then with 
a comparator that is comparing by name (asc) you will see the following in page 1:
"a"
"c"
"e"
and the following in page 2:
"b"
"d"
"f"

However, I assume that in this case, we would ideally want to see the following in page 1:
"a"
"b"
"c"
and the following in page 2:
"d"
"e"
"f"

also: @Lior - what happens when the search query contains a "sort by" part? 
there is a chance that the behaivor would be unexpected in this case; 

I believe that the correct thing to do is to "attach" the GUI sorting mechanism 
to the one in the search mechanism.

thoughts?

> 
> 
> > 
> > http://gerrit.ovirt.org/#/c/15846/
> > 
> > If a comparator isn't set, then everything should behave as before. If a
> > comparator is set, then from that moment on the tab items will be kept
> > in a SortedSet, so that even if an item is added in a way that doesn't
> > trigger an event (e.g. getItems().add()) the items will be kept sorted
> > according to the given comparator. If the comparator is set to null,
> > from that moment on the tab should revert to its old behaviour.
> > 
> > You're most welcome to have a look and let me know if this might break
> > something (remember though that it's not obligatory to set a comparator,
> > so only possible breakage should be in generic flows).
> > 
> > Feel free to use it once it's merged; along with SortedListModel, this
> > should make sorting less painful. Just keep in mind that once you set a
> > comparator, you can't cast getItems() to a List. This shouldn't be a
> > problem in general, as mostly it's as useful (and probably more correct)
> > to cast to a Collection.
> > 
> > Lior.
> > _______________________________________________
> > Engine-devel mailing list
> > Engine-devel at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/engine-devel
> > 
> _______________________________________________
> Engine-devel mailing list
> Engine-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel
> 



More information about the Devel mailing list