Thread: [pgAdmin4][Patch]: Fixed Ascending/Descending order in backgrid

[pgAdmin4][Patch]: Fixed Ascending/Descending order in backgrid

From
Khushboo Vashi
Date:
Hi,

The ascending/descending order is not working in the backgrid while clicking on the headers.
If this functionality is required then please find the attached fix for the same.

Thanks,
Khushboo


Attachment

Re: [pgAdmin4][Patch]: Fixed Ascending/Descendingorder in backgrid

From
Atira Odhner
Date:
Hi Khushboo,

Matt and I took a look at your patch and noticed that there is code duplication between the lines you added and the preceding block of code. 

Instead of repeating the code in the else block, why not just remove the if condition?
Also, the BigNumber casting in the previous block seems unnecessary since there is no arithmetic, only comparisons happening. 

It may help to add some jasmine tests around the makeComparator method.

Tira & Matt


On Mon, Mar 27, 2017 at 8:01 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

The ascending/descending order is not working in the backgrid while clicking on the headers.
If this functionality is required then please find the attached fix for the same.

Thanks,
Khushboo




--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgAdmin4][Patch]: Fixed Ascending/Descendingorder in backgrid

From
Khushboo Vashi
Date:
Hi Tira,

On Mon, Mar 27, 2017 at 9:00 PM, Atira Odhner <aodhner@pivotal.io> wrote:
Hi Khushboo,

Matt and I took a look at your patch and noticed that there is code duplication between the lines you added and the preceding block of code. 

Instead of repeating the code in the else block, why not just remove the if condition?
 
The code in If condition was introduced to handle the sorting of number sequences.

Also, the BigNumber casting in the previous block seems unnecessary since there is no arithmetic, only comparisons happening.
 
As we get the number and integer cell value into string format, the direct comparison fails.
If we convert string into integer then the long numbers will not get sorted properly; so to handle this the BigNumber casting was used.

 
It may help to add some jasmine tests around the makeComparator method.

Tira & Matt


On Mon, Mar 27, 2017 at 8:01 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

The ascending/descending order is not working in the backgrid while clicking on the headers.
If this functionality is required then please find the attached fix for the same.

Thanks,
Khushboo




--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers



Thanks,
Khushboo 

Re: [pgAdmin4][Patch]: Fixed Ascending/Descendingorder in backgrid

From
Dave Page
Date:
Thanks, applied.

On Tue, Mar 28, 2017 at 2:41 AM, Khushboo Vashi
<khushboo.vashi@enterprisedb.com> wrote:
> Hi Tira,
>
> On Mon, Mar 27, 2017 at 9:00 PM, Atira Odhner <aodhner@pivotal.io> wrote:
>>
>> Hi Khushboo,
>>
>> Matt and I took a look at your patch and noticed that there is code
>> duplication between the lines you added and the preceding block of code.
>>
>> Instead of repeating the code in the else block, why not just remove the
>> if condition?
>
>
> The code in If condition was introduced to handle the sorting of number
> sequences.
>
>> Also, the BigNumber casting in the previous block seems unnecessary since
>> there is no arithmetic, only comparisons happening.
>
>
> As we get the number and integer cell value into string format, the direct
> comparison fails.
> If we convert string into integer then the long numbers will not get sorted
> properly; so to handle this the BigNumber casting was used.
>
> Ref RM https://redmine.postgresql.org/issues/1938
>>
>>
>>
>> It may help to add some jasmine tests around the makeComparator method.
>>
>> Tira & Matt
>>
>>
>> On Mon, Mar 27, 2017 at 8:01 AM, Khushboo Vashi
>> <khushboo.vashi@enterprisedb.com> wrote:
>>>
>>> Hi,
>>>
>>> The ascending/descending order is not working in the backgrid while
>>> clicking on the headers.
>>> If this functionality is required then please find the attached fix for
>>> the same.
>>>
>>> Thanks,
>>> Khushboo
>>>
>>>
>>>
>>>
>>> --
>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>
>>
>
> Thanks,
> Khushboo
>



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company