[ovirt-devel] Sortable Ui Columns

Alexander Wels awels at redhat.com
Fri May 30 12:25:20 UTC 2014


Anmol,

This is due to the fact that the sorting is done by a SortedSet instead of a 
list in the SortedListModel. To fix this we have to do one of two things:

1. Change the sorting to use a list of some sort, but apparently that is not 
much of an option as people want automatic sorting when they add new items to 
the collection.
2. Make sure that the comparator never returns 0 for two entities that are 
really not the same. The reason you are seeing the issue is because you are 
using a different comparator that does return 0 on whatever field you are 
comparing against. I had the exact same issue and I solved it by using a 
compound comparator. Basically what I did was create a comparator that 
contains the field I am trying to compare on and if that returns 0 then I use a 
different comparator that is guaranteed to not return 0 for the entity.

I have a patch that implements sorting for all the data center main tab and 
sub tabs here [1] that demonstrates how I solved the issue. This patch hasn't 
been reviewed yet, and my solution might get rejected, but it does work and 
doesn't make your entries disappear when you sort.


[1] http://gerrit.ovirt.org/#/c/28225/

On Friday, May 30, 2014 02:32:17 AM Anmol Babu wrote:
> Hi,
>    While applying client-side sort using the sorting infra, to the "Server"
> column of the "Volumes" sub tab "Bricks", I had 2 Bricks with same server
> name.So,when I sorted it, it removed one of the bricks that had the same
> server name. I found that this issue occurs when the sort values compared
> are same(i.e, comparator's compare returns 0). Regards,
> Anmol.B
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel




More information about the Devel mailing list