Subject: Backgrid Select2cell multiselect support [pgadmin4]

From: Harshal Dhumal <[email-masked]>
Date: Thu, 5 May 2016 20:15:40 +0530

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>
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)

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

---

From: Ashesh Vashi <[email-masked]>
Date: Tue, 10 May 2016 13:50:17 +0530

Thanks - committed with some tweaks.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
<http://www.enterprisedb.com>

*http://www.linkedin.com/in/asheshvashi*
<http://www.linkedin.com/in/asheshvashi>