public inbox for [email protected]  
help / color / mirror / Atom feed
PATCH: Do not sort columns based on their lables (pgAdmin4)
2+ messages / 2 participants
[nested] [flat]

* PATCH: Do not sort columns based on their lables (pgAdmin4)
@ 2016-09-14 07:22  Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Murtuza Zabuawala @ 2016-09-14 07:22 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

PFA patch to fix the issue where we were sorting columns based on labels
instead of their position.
RM#1687

Please review.
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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


Attachments:

  [text/x-patch] RM_1687.patch (3.0K, 3-RM_1687.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js
index 7a202e8..2e494ab 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -35,7 +35,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
 
   var processTreeData = function(payload) {
     var data = JSON.parse(payload).data.sort(function(a, b) {
-      return pgAdmin.natural_sort(a.label, b.label, {});
+        return pgAdmin.natural_sort(a.label, b.label, {'_type': a._type});
     });
     _.each(data, function(d){
       d._label = d.label;
@@ -855,7 +855,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
                           d = ctx.t.itemData(i);
                           if (
                             pgAdmin.natural_sort(
-                              d._label, _data._label, {}
+                              d._label, _data._label, {'_type': d._type}
                             ) == 1
                           )
                             return true;
@@ -880,7 +880,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
                           d = ctx.t.itemData(i);
                           if (
                             pgAdmin.natural_sort(
-                              d._label, _data._label, {}
+                              d._label, _data._label, {'_type': d._type}
                             ) != -1
                           )
                             return true;
@@ -888,7 +888,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
                           d = ctx.t.itemData(i);
                           if (
                             pgAdmin.natural_sort(
-                              d._label, _data._label, {}
+                              d._label, _data._label, {'_type': d._type}
                             ) != 1
                           )
                             return true;
@@ -897,7 +897,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
                           d = ctx.t.itemData(i);
                           if (
                             pgAdmin.natural_sort(
-                              d._label, _data._label, {}
+                              d._label, _data._label, {'_type': d._type}
                             ) == 1
                           ) {
                             s = m + 1;
diff --git a/web/pgadmin/static/js/pgadmin.js b/web/pgadmin/static/js/pgadmin.js
index 7ab1e3f..fd175f7 100644
--- a/web/pgadmin/static/js/pgadmin.js
+++ b/web/pgadmin/static/js/pgadmin.js
@@ -40,6 +40,11 @@
         oFxNcL, oFyNcL,
         mult = options.desc ? -1 : 1;
 
+    // If object is of column type then do not sort
+    if(options.hasOwnProperty("_type") && options._type &&
+        (options._type != 'column' || options._type != 'catalog_object_column'))
+      return 0;
+
     // first try and sort Hex codes or Dates
     if (yD)
       if ( xD < yD ) return -1 * mult;


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PATCH: Do not sort columns based on their lables (pgAdmin4)
@ 2016-09-14 10:14  Dave Page <[email protected]>
  parent: Murtuza Zabuawala <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2016-09-14 10:14 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Wed, Sep 14, 2016 at 8:22 AM, Murtuza Zabuawala
<[email protected]> wrote:
> Hi,
>
> PFA patch to fix the issue where we were sorting columns based on labels
> instead of their position.
> RM#1687
>
> Please review.
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>



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

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


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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-09-14 10:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14 07:22 PATCH: Do not sort columns based on their lables (pgAdmin4) Murtuza Zabuawala <[email protected]>
2016-09-14 10:14 ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox