public inbox for [email protected]  
help / color / mirror / Atom feed
From: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][PATCH] SlickGrid column resize triggers column select
Date: Fri, 5 May 2017 15:24:58 +0530
Message-ID: <CAKKotZRr9gmtsw8yitx2B-QQUXRn2MeKGix4XpCMGnoDkVF=tw@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi,

PFA patch to fix the issue where in SlickGrid column resize also triggers
'onHeaderClick' event and triggers column selection, In this
scenario before drag event which column is under mouse gets selected, So to
fix the issue we will check if header checkbox is clicked.
RM#2348

Please review.

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

diff --git a/web/pgadmin/static/js/selection/column_selector.js b/web/pgadmin/static/js/selection/column_selector.js
index c89b3fa..5260fc3 100644
--- a/web/pgadmin/static/js/selection/column_selector.js
+++ b/web/pgadmin/static/js/selection/column_selector.js
@@ -6,12 +6,10 @@ define(['jquery', 'sources/selection/range_selection_helper', 'slickgrid'], func
 
           if (column.selectable !== false) {
 
-            if (!clickedCheckbox(event)) {
+            if (clickedCheckbox(event)) {
               var $checkbox = $("[data-id='checkbox-" + column.id + "']");
-              toggleCheckbox($checkbox);
+              updateRanges(grid, column.id);
             }
-
-            updateRanges(grid, column.id);
           }
         }
       );
@@ -55,14 +53,6 @@ define(['jquery', 'sources/selection/range_selection_helper', 'slickgrid'], func
       return e.target.type == "checkbox"
     };
 
-    var toggleCheckbox = function (checkbox) {
-      if (checkbox.prop("checked")) {
-        checkbox.prop("checked", false)
-      } else {
-        checkbox.prop("checked", true)
-      }
-    };
-
     var getColumnDefinitionsWithCheckboxes = function (columnDefinitions) {
       return _.map(columnDefinitions, function (columnDefinition) {
         if (columnDefinition.selectable !== false) {


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


Attachments:

  [text/plain] RM_2348.diff (1.3K, 3-RM_2348.diff)
  download | inline diff:
diff --git a/web/pgadmin/static/js/selection/column_selector.js b/web/pgadmin/static/js/selection/column_selector.js
index c89b3fa..5260fc3 100644
--- a/web/pgadmin/static/js/selection/column_selector.js
+++ b/web/pgadmin/static/js/selection/column_selector.js
@@ -6,12 +6,10 @@ define(['jquery', 'sources/selection/range_selection_helper', 'slickgrid'], func
 
           if (column.selectable !== false) {
 
-            if (!clickedCheckbox(event)) {
+            if (clickedCheckbox(event)) {
               var $checkbox = $("[data-id='checkbox-" + column.id + "']");
-              toggleCheckbox($checkbox);
+              updateRanges(grid, column.id);
             }
-
-            updateRanges(grid, column.id);
           }
         }
       );
@@ -55,14 +53,6 @@ define(['jquery', 'sources/selection/range_selection_helper', 'slickgrid'], func
       return e.target.type == "checkbox"
     };
 
-    var toggleCheckbox = function (checkbox) {
-      if (checkbox.prop("checked")) {
-        checkbox.prop("checked", false)
-      } else {
-        checkbox.prop("checked", true)
-      }
-    };
-
     var getColumnDefinitionsWithCheckboxes = function (columnDefinitions) {
       return _.map(columnDefinitions, function (columnDefinition) {
         if (columnDefinition.selectable !== false) {


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin4][PATCH] SlickGrid column resize triggers column select
  In-Reply-To: <CAKKotZRr9gmtsw8yitx2B-QQUXRn2MeKGix4XpCMGnoDkVF=tw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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