[ovirt-devel] Sortable Ui Columns

Lior Vernia lvernia at redhat.com
Mon Jun 2 08:27:26 UTC 2014


After discussing this with Alex on another thread, I just pushed this:
http://gerrit.ovirt.org/#/c/28268/

If it's approved, then it'll take care of the secondary criterion for
you, so you only need to pass the criterion that actually interests you.
Should simplify our work in the next couple of weeks.

On 31/05/14 15:35, Anmol Babu wrote:
> Thanks a lot Alexander.Your idea of having a second criteria based sorting just in case of comparing same values(compare returning 0) looks good to me and now, I have also done the same in my patch set http://gerrit.ovirt.org/#/c/28233/.I have added you as a reviewer as well.
> Thanks,
> Anmol
> 
> ----- Original Message -----
> From: "Alexander Wels" <awels at redhat.com>
> To: devel at ovirt.org
> Cc: "Anmol Babu" <anbabu at redhat.com>
> Sent: Friday, May 30, 2014 5:55:20 PM
> Subject: Re: [ovirt-devel] Sortable Ui Columns
> 
> 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
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel
> 



More information about the Devel mailing list