From 585daddce2ef6b95c927d239605fec458b11d73d Mon Sep 17 00:00:00 2001 From: Harshal Dhumal Date: Thu, 12 May 2016 16:14:01 +0530 Subject: [PATCH] Destroy the existing Select2 object before rerendering the control. --- web/pgadmin/browser/static/js/node.ui.js | 7 ++++++- web/pgadmin/static/js/backform.pgadmin.js | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js index de30e489b..8bf71dce3 100644 --- a/web/pgadmin/browser/static/js/node.ui.js +++ b/web/pgadmin/browser/static/js/node.ui.js @@ -142,6 +142,11 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) { } }, render: function() { + + if(this.$sel && this.$sel.select2) { + this.$sel.select2('destroy') + } + /* * Let SelectControl render it, we will do our magic on the * select control in it. @@ -167,7 +172,7 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) { * Add empty option as Select2 requires any empty '')); - $select.select2(select2Opts); + this.$sel = $select.select2(select2Opts); return this; }