public inbox for [email protected]  
help / color / mirror / Atom feed
From: Harshal Dhumal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: Backgrid Select2cell multiselect support [pgadmin4]
Date: Thu, 5 May 2016 20:15:40 +0530
Message-ID: <CAFiP3vwkka+=1FOJ7kr2zbC4AzecoCa9eO9DZ34-Oyy_9gE92g@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi,

PFA patch for backgrid Select2cell in which I have added multiselect
support which was missing.

-- 
*Harshal Dhumal*
*Software Engineer *



EenterpriseDB <http://www.enterprisedb.com;


-- 
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] select2Cell_multiselect_support_5_May_v1.patch (1.5K, 3-select2Cell_multiselect_support_5_May_v1.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/backgrid/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid/backgrid.pgadmin.js
index 55ba7c0..d2d4486 100644
--- a/web/pgadmin/static/js/backgrid/backgrid.pgadmin.js
+++ b/web/pgadmin/static/js/backgrid/backgrid.pgadmin.js
@@ -396,7 +396,7 @@
     editor: null,
 
     defaults: _.defaults({
-      select2: {},
+      select2: {multiple:false},
       opt: {
         label: null,
         value: null,
@@ -471,11 +471,18 @@
       var optionText = null,
           optionValue = null,
           model = this.model,
-          selectedValues = model.get(this.column.get("name"));
+          selectedValues = model.get(this.column.get("name")),
+          self = this,
+          select2_opts = _.extend(
+            {openOnEnter: false},
+            col.select2, this.defaults.select2
+            ),
+          selectTpl = _.template('<select <%=multiple ? "multiple" : "" %>></select>');
 
       delete this.$select;
-      self = this,
-      $select = self.$select = $('<select></select>').appendTo(this.$el);
+
+      $select = self.$select = $(selectTpl(
+          {multiple:select2_opts.multiple})).appendTo(this.$el);
 
       for (var i = 0; i < optionValues.length; i++) {
         var opt = optionValues[i];
@@ -501,11 +508,6 @@
         }
       }
 
-      var select2_opts = _.extend(
-            {openOnEnter: false},
-            col.select2, this.defaults.select2
-            );
-
       if(col && _.has(col.disabled)) {
         _.extend(select2_opts, {
           disabled: evalF(col.disabled, col, model)


view thread (2+ 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: Backgrid Select2cell multiselect support [pgadmin4]
  In-Reply-To: <CAFiP3vwkka+=1FOJ7kr2zbC4AzecoCa9eO9DZ34-Oyy_9gE92g@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