diff --git a/web/pgadmin/static/js/alertify.pgadmin.defaults.js b/web/pgadmin/static/js/alertify.pgadmin.defaults.js
index 81bd7eb5..3129ecc6 100644
--- a/web/pgadmin/static/js/alertify.pgadmin.defaults.js
+++ b/web/pgadmin/static/js/alertify.pgadmin.defaults.js
@@ -1,135 +1,138 @@
-define(
-    ['sources/gettext', 'alertify', 'underscore.string'],
-function(gettext, alertify, S) {
-  alertify.defaults.transition = "zoom";
-  alertify.defaults.theme.ok = "btn btn-primary";
-  alertify.defaults.theme.cancel = "btn btn-danger";
-  alertify.defaults.theme.input = "form-control";
+define([
+  'sources/gettext', 'alertify', 'jquery',
+], function(gettext, alertify, $) {
+  alertify.defaults.transition = 'zoom';
+  alertify.defaults.theme.ok = 'btn btn-primary';
+  alertify.defaults.theme.cancel = 'btn btn-danger';
+  alertify.defaults.theme.input = 'form-control';
   alertify.pgIframeDialog || alertify.dialog('pgIframeDialog', function() {
     var iframe;
     return {
-        // dialog constructor function, this will be called when the user calls
-        // alertify.pgIframeDialog(message)
-        main:function(message){
-            //set the videoId setting and return current instance for chaining.
-            return this.set({
-                'pg_msg': message
-            });
-        },
-        // we only want to override two options (padding and overflow).
-        setup: function(){
-            return {
-                options:{
-                    //disable both padding and overflow control.
-                    padding : !1,
-                    overflow: !1,
-                }
-            };
-        },
-        // This will be called once the DOM is ready and will never be invoked
-        // again. Here we create the iframe to embed the video.
-        build:function() {
-            // create the iframe element
-            iframe = document.createElement('iframe');
-
-            iframe.src = "";
-            iframe.frameBorder = "no";
-            iframe.width = "100%";
-            iframe.height = "100%";
-
-            // add it to the dialog
-            this.elements.content.appendChild(iframe);
-
-            //give the dialog initial height (half the screen height).
-            this.elements.body.style.minHeight = screen.height * .5 + 'px';
-        },
-        // dialog custom settings
-        settings:{
-            pg_msg: undefined
-        },
-        // listen and respond to changes in dialog settings.
-        settingUpdated: function(key, oldValue, newValue){
-            switch(key){
-               case 'pg_msg':
-                  var doc = iframe.contentWindow || iframe.contentDocument;
-                  if (doc.document) {
-                    doc = doc.document;
-                  }
-
-                  doc.open();
-                  doc.write(newValue);
-                  doc.close();
-
-                  break;
+      // dialog constructor function, this will be called when the user calls
+      // alertify.pgIframeDialog(message)
+      main: function(message) {
+        //set the videoId setting and return current instance for chaining.
+        return this.set({
+          'pg_msg': message,
+        });
+      },
+      // we only want to override two options (padding and overflow).
+      setup: function() {
+        return {
+          options: {
+            //disable both padding and overflow control.
+            padding: !1,
+            overflow: !1,
+          },
+        };
+      },
+      // This will be called once the DOM is ready and will never be invoked
+      // again. Here we create the iframe to embed the video.
+      build: function() {
+        // create the iframe element
+        iframe = document.createElement('iframe');
+
+        iframe.src = '';
+        iframe.frameBorder = 'no';
+        iframe.width = '100%';
+        iframe.height = '100%';
+
+        // add it to the dialog
+        this.elements.content.appendChild(iframe);
+
+        //give the dialog initial height (half the screen height).
+        this.elements.body.style.minHeight = screen.height * .5 + 'px';
+      },
+      // dialog custom settings
+      settings: {
+        pg_msg: undefined,
+      },
+      // listen and respond to changes in dialog settings.
+      settingUpdated: function(key, oldValue, newValue) {
+        switch (key) {
+        case 'pg_msg':
+          var doc = iframe.contentWindow || iframe.contentDocument;
+          if (doc.document) {
+            doc = doc.document;
+          }
+
+          doc.open();
+          doc.write(newValue);
+          doc.close();
+
+          break;
+        }
+      },
+      // listen to internal dialog events.
+      hooks: {
+        // triggered when a dialog option gets update.
+        // warning! this will not be triggered for settings updates.
+        onupdate: function(option, oldValue, newValue) {
+          switch (option) {
+          case 'resizable':
+            if (newValue) {
+              this.elements.content.removeAttribute('style');
+              iframe && iframe.removeAttribute('style');
+            } else {
+              this.elements.content.style.minHeight = 'inherit';
+              iframe && (iframe.style.minHeight = 'inherit');
             }
+            break;
+          }
         },
-        // listen to internal dialog events.
-        hooks: {
-            // triggered when a dialog option gets update.
-            // warning! this will not be triggered for settings updates.
-            onupdate: function(option,oldValue, newValue){
-                switch(option){
-                    case 'resizable':
-                        if(newValue){
-                            this.elements.content.removeAttribute('style');
-                            iframe && iframe.removeAttribute('style');
-                        }else{
-                            this.elements.content.style.minHeight = 'inherit';
-                            iframe && (iframe.style.minHeight = 'inherit');
-                        }
-                    break;
-                }
-            }
-        }
+      },
     };
   });
   alertify.pgNotifier = function(type, xhr, promptmsg, onJSONResult) {
-      var msg = xhr.responseText,
-          contentType = xhr.getResponseHeader('Content-Type');
-
-      if (xhr.status == 0) {
-        msg = gettext('Connection to the server has been lost.');
-        promptmsg = gettext('Connection Lost');
-      } else {
-        if (contentType) {
-          try {
-            if (contentType.indexOf('application/json') == 0) {
-              var resp = $.parseJSON(msg);
-
-              if (resp.result != null && (!resp.errormsg || resp.errormsg == '') &&
-                  onJSONResult && typeof(onJSONResult) == 'function') {
-                return onJSONResult(resp.result);
-              }
-              msg = _.escape(resp.result) || _.escape(resp.errormsg) || "Unknown error";
+    var msg = xhr.responseText,
+      contentType = xhr.getResponseHeader('Content-Type');
+
+    if (xhr.status == 0) {
+      msg = gettext('Connection to the server has been lost.');
+      promptmsg = gettext('Connection Lost');
+    } else {
+      if (contentType) {
+        try {
+          if (contentType.indexOf('application/json') == 0) {
+            var resp = $.parseJSON(msg);
+
+            if (resp.result != null && (!resp.errormsg || resp.errormsg == '') &&
+              onJSONResult && typeof(onJSONResult) == 'function') {
+              return onJSONResult(resp.result);
             }
-            if (contentType.indexOf('text/html') == 0) {
-              var alertMessage = promptmsg;
-              if (type === 'error') {
-                alertMessage = '\
+            msg = _.escape(resp.result) || _.escape(resp.errormsg) || 'Unknown error';
+          }
+          if (contentType.indexOf('text/html') == 0) {
+            var alertMessage = promptmsg;
+            if (type === 'error') {
+              alertMessage = '\
                   <div class="media font-red-3 text-14">\
                     <div class="media-body media-middle">\
                       <div class="alert-text">' + promptmsg + '</div><br/>\
                       <div class="alert-text">' + gettext('Click for details.') + '</div>\
                     </div>\
                   </div>';
-              }
-
-              alertify.notify(
-                alertMessage, type, 0, function() {
-                  alertify.pgIframeDialog().show().set({frameless: false}).set(
-                    'pg_msg', msg
-                  );
-                });
-                return;
             }
-          } catch (e) {
-            alertify.alert().show().set('message', e.message).set('title', "Error");
+
+            alertify.notify(
+              alertMessage, type, 0,
+              function() {
+                alertify.pgIframeDialog().show().set({
+                  frameless: false,
+                }).set(
+                  'pg_msg', msg
+                );
+              });
+            return;
           }
+        } catch (e) {
+          alertify.alert().show().set('message', e.message).set('title', 'Error');
         }
       }
-      alertify.alert().show().set(
-        'message', msg.replace(new RegExp('\r?\n','g'), '<br />')
-        ).set('title', promptmsg);
+    }
+    alertify.alert().show().set(
+      'message', msg.replace(new RegExp(/\r?\n/, 'g'), '<br />')
+    ).set('title', promptmsg);
   };
 
   var alertifyDialogResized = function(stop) {
@@ -139,14 +142,14 @@ function(gettext, alertify, S) {
       self.pgResizeRecursion = false;
     }
 
-    if(self.pgResizeTimeout) {
+    if (self.pgResizeTimeout) {
       return;
     }
 
     self.pgResizeTimeout = setTimeout(
       function() {
         var $el = $(this.elements.dialog),
-            w = $el.width();
+          w = $el.width();
 
         this.pgResizeTimeout = null;
 
@@ -186,7 +189,7 @@ function(gettext, alertify, S) {
 
   alertify.pgDialogBuild = function() {
     this.set('onshow', function() {
-      this.elements.dialog.classList.add('pg-el-container')
+      this.elements.dialog.classList.add('pg-el-container');
       alertifyDialogResized.apply(this, arguments);
     });
     this.set('onresize', alertifyDialogStartResizing.bind(this, true));
@@ -202,23 +205,21 @@ function(gettext, alertify, S) {
       return;
     }
 
-    var msg = xhr.responseText,
-        contentType = xhr.getResponseHeader('Content-Type'),
-        msg = xhr.responseText,
-        jsonResp = contentType &&
-          contentType.indexOf('application/json') == 0 &&
-            $.parseJSON(xhr.responseText);
+    var contentType = xhr.getResponseHeader('Content-Type'),
+      jsonResp = contentType &&
+      contentType.indexOf('application/json') == 0 &&
+      $.parseJSON(xhr.responseText);
 
     if (
       jsonResp && (
         xhr.status == 503 ? (
           jsonResp.info == 'CONNECTION_LOST' &&
-            'server' in args.info && jsonResp.data.sid >= 0 &&
-              jsonResp.data.sid == args.info.server._id
+          'server' in args.info && jsonResp.data.sid >= 0 &&
+          jsonResp.data.sid == args.info.server._id
         ) : (
-        xhr.status == 428 &&
+          xhr.status == 428 &&
           jsonResp.errormsg &&
-            jsonResp.errormsg == gettext("Connection to the server has been lost.")
+          jsonResp.errormsg == gettext('Connection to the server has been lost.')
         )
       )
     ) {
@@ -231,60 +232,60 @@ function(gettext, alertify, S) {
 
       // Check the status of the maintenance server connection.
       var server = pgBrowser.Nodes['server'],
-          ctx = {
-            resp: jsonResp,
-            xhr: xhr,
-            args: args
-          },
-          reconnectServer = function() {
-            var ctx = this,
-                onServerConnect = function(_sid, _i, _d) {
-                  // Yay - server is reconnected.
-                  if (this.args.info.server._id == _sid) {
-                    pgBrowser.Events.off(
-                      'pgadmin:server:connected', onServerConnect
-                    );
-                    pgBrowser.Events.off(
-                      'pgadmin:server:connect:cancelled', onConnectCancel
-                    );
-
-                    // Do we need to connect the disconnected server now?
-                    if (
-                      this.resp.data.database &&
-                      this.resp.data.database != _d.db
-                    ) {
-                      // Server is connected now, we will need to inform the
-                      // database to connect it now.
-                      pgBrowser.Events.trigger(
-                        'pgadmin:database:connection:lost', this.args.item,
-                        this.resp, true
-                      );
-                    }
-                  }
-                }.bind(ctx),
-                onConnectCancel = function(_sid, _item, _data) {
-                  // User has cancelled the operation in between.
-                  if (_sid == this.args.info.server.id) {
-                    pgBrowser.Events.off('pgadmin:server:connected', onServerConnect);
-                    pgBrowser.Events.off('pgadmin:server:connect:cancelled', onConnectCancel);
-
-                    // Connection to the database will also be cancelled
-                    pgBrowser.Events.trigger(
-                      'pgadmin:database:connect:cancelled', _sid,
-                      this.resp.data.database || _data.db, _item, _data
-                    );
-                  }
-                }.bind(ctx);
-
-            pgBrowser.Events.on('pgadmin:server:connected', onServerConnect);
-            pgBrowser.Events.on('pgadmin:server:connect:cancelled', onConnectCancel);
-
-            // Connection to the server has been lost, we need to inform the
-            // server first to take the action first.
-            pgBrowser.Events.trigger(
-              'pgadmin:server:connection:lost', this.args.item, this.resp
-            );
-          }.bind(ctx);
+        ctx = {
+          resp: jsonResp,
+          xhr: xhr,
+          args: args,
+        },
+        reconnectServer = function() {
+          var ctx = this,
+            onServerConnect = function(_sid, _i, _d) {
+              // Yay - server is reconnected.
+              if (this.args.info.server._id == _sid) {
+                pgBrowser.Events.off(
+                  'pgadmin:server:connected', onServerConnect
+                );
+                pgBrowser.Events.off(
+                  'pgadmin:server:connect:cancelled', onConnectCancel
+                );
+
+                // Do we need to connect the disconnected server now?
+                if (
+                  this.resp.data.database &&
+                  this.resp.data.database != _d.db
+                ) {
+                  // Server is connected now, we will need to inform the
+                  // database to connect it now.
+                  pgBrowser.Events.trigger(
+                    'pgadmin:database:connection:lost', this.args.item,
+                    this.resp, true
+                  );
+                }
+              }
+            }.bind(ctx),
+            onConnectCancel = function(_sid, _item, _data) {
+              // User has cancelled the operation in between.
+              if (_sid == this.args.info.server.id) {
+                pgBrowser.Events.off('pgadmin:server:connected', onServerConnect);
+                pgBrowser.Events.off('pgadmin:server:connect:cancelled', onConnectCancel);
+
+                // Connection to the database will also be cancelled
+                pgBrowser.Events.trigger(
+                  'pgadmin:database:connect:cancelled', _sid,
+                  this.resp.data.database || _data.db, _item, _data
+                );
+              }
+            }.bind(ctx);
+
+          pgBrowser.Events.on('pgadmin:server:connected', onServerConnect);
+          pgBrowser.Events.on('pgadmin:server:connect:cancelled', onConnectCancel);
+
+          // Connection to the server has been lost, we need to inform the
+          // server first to take the action first.
+          pgBrowser.Events.trigger(
+            'pgadmin:server:connection:lost', this.args.item, this.resp
+          );
+        }.bind(ctx);
 
       $.ajax({
         url: server.generate_url(
@@ -309,7 +310,7 @@ function(gettext, alertify, S) {
         },
         error: function() {
           reconnectServer();
-        }
+        },
       });
       return true;
     }
@@ -317,18 +318,19 @@ function(gettext, alertify, S) {
   };
 
   var alertifySuccess = alertify.success,
-      alertifyError   = alertify.error;
+    alertifyError = alertify.error;
 
   /*
   For adding the jasmine test cases, we needed to refer the original success,
    and error functions, as orig_success and orig_error respectively.
   */
   _.extend(alertify, {
-    orig_success: alertifySuccess, orig_error: alertifyError
+    orig_success: alertifySuccess,
+    orig_error: alertifyError,
   });
 
   _.extend(alertify, {
-    success: function (message, timeout, callback) {
+    success: function(message, timeout, callback) {
       var alertMessage = '\
       <div class="media font-green-3 text-14">\
         <div class="media-body media-middle">\
@@ -364,7 +366,7 @@ function(gettext, alertify, S) {
       </div>';
       var alert = alertify.notify(alertMessage, timeout);
       return alert;
-    }
+    },
   });
 
   return alertify;
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 432cdd7e..4f3b1449 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -1,41 +1,15 @@
-(function(root, factory) {
-
-  // Set up Backform appropriately for the environment. Start with AMD.
-  if (typeof define === 'function' && define.amd) {
-    define([
-      'sources/gettext', 'underscore', 'underscore.string', 'jquery',
-      'backbone', 'backform', 'backgrid', 'codemirror', 'spectrum',
-      'pgadmin.backgrid', 'select2'
-      ],
-     function(gettext, _, S, $, Backbone, Backform, Backgrid, CodeMirror) {
-      // Export global even in AMD case in case this script is loaded with
-      // others that may still expect a global Backform.
-      return factory(root, gettext, _, S, $, Backbone, Backform, Backgrid, CodeMirror);
-    });
-
-  // Next for Node.js or CommonJS. jQuery may not be needed as a module.
-  } else if (typeof exports !== 'undefined') {
-    var _ = require('underscore') || root._,
-      $ = root.jQuery || root.$ || root.Zepto || root.ender,
-      Backbone = require('backbone') || root.Backbone,
-      Backform = require('backform') || root.Backform,
-      Backgrid = require('backgrid') || root.Backgrid,
-      CodeMirror = require('codemirror') || root.CodeMirror,
-      S = require('underscore.string'),
-      gettext = require('sources/gettext');
-    factory(root, gettext, _, S, $, Backbone, Backform, Backgrid, CodeMirror);
-  // Finally, as a browser global.
-  } else {
-    factory(root, root.gettext, root._, root.s, (root.jQuery || root.Zepto || root.ender || root.$), root.Backbone, root.Backform, root.Backgrid, root.CodeMirror);
-  }
-}(this, function(root, gettext, _, S, $, Backbone, Backform, Backgrid, CodeMirror) {
+define([
+  'sources/gettext', 'underscore', 'underscore.string', 'jquery',
+  'backbone', 'backform', 'backgrid', 'codemirror', 'spectrum',
+  'pgadmin.backgrid', 'select2',
+], function(gettext, _, S, $, Backbone, Backform, Backgrid, CodeMirror) {
 
   var pgAdmin = (window.pgAdmin = window.pgAdmin || {});
 
   pgAdmin.editableCell = function() {
     if (this.attributes && !_.isUndefined(this.attributes.disabled) &&
-        !_.isNull(this.attributes.disabled)) {
-      if(_.isFunction(this.attributes.disabled)) {
+      !_.isNull(this.attributes.disabled)) {
+      if (_.isFunction(this.attributes.disabled)) {
         return !(this.attributes.disabled.apply(this, arguments));
       }
       if (_.isBoolean(this.attributes.disabled)) {
@@ -47,15 +21,15 @@
   // HTML markup global class names. More can be added by individual controls
   // using _.extend. Look at RadioControl as an example.
   _.extend(Backform, {
-    controlLabelClassName: "control-label pg-el-sm-3 pg-el-xs-12",
-    controlsClassName: "pgadmin-controls pg-el-sm-9 pg-el-xs-12",
-    groupClassName: "pgadmin-control-group form-group pg-el-xs-12",
-    setGroupClassName: "set-group pg-el-xs-12",
-    tabClassName: "backform-tab pg-el-xs-12",
-    setGroupContentClassName: "fieldset-content pg-el-xs-12"
-    });
+    controlLabelClassName: 'control-label pg-el-sm-3 pg-el-xs-12',
+    controlsClassName: 'pgadmin-controls pg-el-sm-9 pg-el-xs-12',
+    groupClassName: 'pgadmin-control-group form-group pg-el-xs-12',
+    setGroupClassName: 'set-group pg-el-xs-12',
+    tabClassName: 'backform-tab pg-el-xs-12',
+    setGroupContentClassName: 'fieldset-content pg-el-xs-12',
+  });
 
-  var controlMapper = Backform.controlMapper = {
+  Backform.controlMapper = {
     'int': ['uneditable-input', 'numeric', 'integer'],
     'text': ['uneditable-input', 'input', 'string'],
     'numeric': ['uneditable-input', 'numeric', 'numeric'],
@@ -66,13 +40,13 @@
     'multiline': ['textarea', 'textarea', 'string'],
     'collection': ['sub-node-collection', 'sub-node-collection', 'string'],
     'uniqueColCollection': ['unique-col-collection', 'unique-col-collection', 'string'],
-    'switch' : 'switch',
+    'switch': 'switch',
     'select2': 'select2',
     'note': 'note',
-    'color': 'color'
+    'color': 'color',
   };
 
-  var getMappedControl = Backform.getMappedControl = function(type, mode) {
+  Backform.getMappedControl = function(type, mode) {
     if (type in Backform.controlMapper) {
       var m = Backform.controlMapper[type];
 
@@ -80,39 +54,42 @@
         return m;
       }
 
-      var idx = 1, len = _.size(m);
+      var idx = 1,
+        len = _.size(m);
 
       switch (mode) {
-        case 'properties':
-          idx = 0;
-          break;
-        case 'edit':
-        case 'create':
-        case 'control':
-          idx = 1;
-          break;
-        case 'cell':
-          idx = 2;
-          break;
-        default:
-          idx = 0;
-          break;
+      case 'properties':
+        idx = 0;
+        break;
+      case 'edit':
+      case 'create':
+      case 'control':
+        idx = 1;
+        break;
+      case 'cell':
+        idx = 2;
+        break;
+      default:
+        idx = 0;
+        break;
       }
 
       return m[idx > len ? 0 : idx];
     }
     return type;
-  }
+  };
 
 
   var BackformControlInit = Backform.Control.prototype.initialize,
-      BackformControlRemove = Backform.Control.prototype.remove;
+    BackformControlRemove = Backform.Control.prototype.remove;
 
   // Override the Backform.Control to allow to track changes in dependencies,
   // and rerender the View element
   _.extend(Backform.Control.prototype, {
 
-    defaults: _.extend(Backform.Control.prototype.defaults, {helpMessage: null}),
+    defaults: _.extend(Backform.Control.prototype.defaults, {
+      helpMessage: null,
+    }),
 
     initialize: function() {
       BackformControlInit.apply(this, arguments);
@@ -125,7 +102,7 @@
         _.each(deps, function(d) {
           var attrArr = d.split('.');
           var name = attrArr.shift();
-          self.listenTo(self.model, "change:" + name, self.render);
+          self.listenTo(self.model, 'change:' + name, self.render);
         });
       }
     },
@@ -133,10 +110,10 @@
     remove: function() {
       // Remove the events for the dependent fields in the model
       var self = this,
-          deps = self.field.get('deps');
+        deps = self.field.get('deps');
 
-      self.stopListening(self.model, "change:" + name, self.render);
-      self.stopListening(self.model.errorModel, "change:" + name, self.updateInvalid);
+      self.stopListening(self.model, 'change:' + name, self.render);
+      self.stopListening(self.model.errorModel, 'change:' + name, self.updateInvalid);
 
       if (deps && _.isArray(deps)) {
         _.each(deps, function(d) {
@@ -144,7 +121,7 @@
           var attrArr = d.split('.');
           var name = attrArr.shift();
 
-          self.stopListening(self.model, "change:" + name, self.render);
+          self.stopListening(self.model, 'change:' + name, self.render);
         });
       }
 
@@ -160,42 +137,41 @@
     },
 
     template: _.template([
-                  '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
-                  '<div class="<%=Backform.controlsClassName%>">',
-                  '  <span class="<%=Backform.controlClassName%> uneditable-input" <%=disabled ? "disabled" : ""%>>',
-                  '    <%-value%>',
-                  '  </span>',
-                  '</div>',
-                  '<% if (helpMessage && helpMessage.length) { %>',
-                  '  <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
-                  '<% } %>',
-                  ].join("\n")),
+      '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
+      '<div class="<%=Backform.controlsClassName%>">',
+      '  <span class="<%=Backform.controlClassName%> uneditable-input" <%=disabled ? "disabled" : ""%>>',
+      '    <%-value%>',
+      '  </span>',
+      '</div>',
+      '<% if (helpMessage && helpMessage.length) { %>',
+      '  <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
+      '<% } %>',
+    ].join('\n')),
 
     clearInvalid: function() {
       this.$el.removeClass(Backform.errorClassName);
-      this.$el.find(".pgadmin-control-error-message").remove();
+      this.$el.find('.pgadmin-control-error-message').remove();
       return this;
     },
 
     updateInvalid: function() {
       var self = this,
-          errorModel = this.model.errorModel;
+        errorModel = this.model.errorModel;
 
       if (!(errorModel instanceof Backbone.Model)) return this;
 
       this.clearInvalid();
 
       /*
-      * Find input which have name attribute.
-      */
+       * Find input which have name attribute.
+       */
       this.$el.find(':input[name]').not('button').each(function(ix, el) {
-        var attrArr = $(el).attr('name').split('.'),
-        name = attrArr.shift(),
-        path = attrArr.join('.'),
-        error = self.keyPathAccessor(errorModel.toJSON(), $(el).attr('name'));
+        var error = self.keyPathAccessor(
+          errorModel.toJSON(), $(el).attr('name')
+        );
 
-      if (_.isEmpty(error)) return;
-      self.$el.addClass(Backform.errorClassName);
+        if (_.isEmpty(error)) return;
+        self.$el.addClass(Backform.errorClassName);
       });
     },
 
@@ -205,26 +181,26 @@
      */
     render: function() {
       var field = _.defaults(this.field.toJSON(), this.defaults),
-          attributes = this.model.toJSON(),
-          attrArr = field.name.split('.'),
-          name = attrArr.shift(),
-          path = attrArr.join('.'),
-          rawValue = this.keyPathAccessor(attributes[name], path),
-          data = _.extend(field, {
-            rawValue: rawValue,
-            value: this.formatter.fromRaw(rawValue, this.model),
-            attributes: attributes,
-            formatter: this.formatter
-          }),
-          evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-          };
+        attributes = this.model.toJSON(),
+        attrArr = field.name.split('.'),
+        name = attrArr.shift(),
+        path = attrArr.join('.'),
+        rawValue = this.keyPathAccessor(attributes[name], path),
+        data = _.extend(field, {
+          rawValue: rawValue,
+          value: this.formatter.fromRaw(rawValue, this.model),
+          attributes: attributes,
+          formatter: this.formatter,
+        }),
+        evalF = function(f, d, m) {
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        };
 
       // Evaluate the disabled, visible, and required option
       _.extend(data, {
         disabled: evalF(data.disabled, data, this.model),
-        visible:  evalF(data.visible, data, this.model),
-        required: evalF(data.required, data, this.model)
+        visible: evalF(data.visible, data, this.model),
+        required: evalF(data.required, data, this.model),
       });
 
       // Clean up first
@@ -237,7 +213,7 @@
       this.updateInvalid();
 
       return this;
-    }
+    },
   });
 
   /*
@@ -247,10 +223,10 @@
   _.extend(
     Backform.InputControl.prototype, {
       events: {
-        "change input": "onChange",
-        "blur input": "onChange",
-        "keyup input": "onKeyUp",
-        "focus input": "clearInvalid"
+        'change input': 'onChange',
+        'blur input': 'onChange',
+        'keyup input': 'onKeyUp',
+        'focus input': 'clearInvalid',
       },
       onKeyUp: function(ev) {
         if (this.key_timeout) {
@@ -260,7 +236,7 @@
         this.keyup_timeout = setTimeout(function() {
           this.onChange(ev);
         }.bind(this), 400);
-      }
+      },
     });
 
   /*
@@ -274,15 +250,18 @@
   _.extend(
     Backform.TextareaControl.prototype, {
       defaults: _.extend(
-        Backform.TextareaControl.prototype.defaults,
-        {rows: 5, helpMessage: null, maxlength: null}
+        Backform.TextareaControl.prototype.defaults, {
+          rows: 5,
+          helpMessage: null,
+          maxlength: null,
+        }
       ),
-      events : {
-        "change textarea": "onChange",
-        "keyup textarea": "onKeyUp",
-        "paste textarea": "onChange",
-        "selectionchange textarea": "onChange",
-        "focus textarea": "clearInvalid"
+      events: {
+        'change textarea': 'onChange',
+        'keyup textarea': 'onKeyUp',
+        'paste textarea': 'onChange',
+        'selectionchange textarea': 'onChange',
+        'focus textarea': 'clearInvalid',
       },
       template: _.template([
         '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
@@ -298,8 +277,8 @@
         '  <% if (helpMessage && helpMessage.length) { %>',
         '    <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
         '  <% } %>',
-        '</div>'
-      ].join("\n")),
+        '</div>',
+      ].join('\n')),
       onKeyUp: function(ev) {
         if (this.key_timeout) {
           clearTimeout(this.key_timeout);
@@ -308,7 +287,7 @@
         this.keyup_timeout = setTimeout(function() {
           this.onChange(ev);
         }.bind(this), 400);
-      }
+      },
     });
 
   /*
@@ -327,7 +306,7 @@
         rawValue: rawValue,
         value: this.formatter.fromRaw(rawValue, this.model),
         attributes: attributes,
-        formatter: this.formatter
+        formatter: this.formatter,
       }),
       evalF = function(f, d, m) {
         return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
@@ -336,16 +315,16 @@
     // Evaluate the disabled, visible, and required option
     _.extend(data, {
       disabled: evalF(data.disabled, data, this.model),
-      visible:  evalF(data.visible, data, this.model),
-      required: evalF(data.required, data, this.model)
+      visible: evalF(data.visible, data, this.model),
+      required: evalF(data.required, data, this.model),
     });
     // Evaluation the options
     if (_.isFunction(data.options)) {
       try {
-        data.options = data.options(this)
-      } catch(e) {
+        data.options = data.options(this);
+      } catch (e) {
         // Do nothing
-        data.options = []
+        data.options = [];
         this.model.trigger('pgadmin-view:transform:error', this.model, this.field, e);
       }
     }
@@ -361,9 +340,11 @@
 
     return this;
   };
-  _.extend(Backform.SelectControl.prototype.defaults, {helpMessage: null});
+  _.extend(Backform.SelectControl.prototype.defaults, {
+    helpMessage: null,
+  });
 
-  var ReadonlyOptionControl = Backform.ReadonlyOptionControl = Backform.SelectControl.extend({
+  Backform.ReadonlyOptionControl = Backform.SelectControl.extend({
     template: _.template([
       '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
       '<div class="<%=Backform.controlsClassName%>">',
@@ -376,12 +357,12 @@
       '<% if (helpMessage && helpMessage.length) { %>',
       '  <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
       '<% } %>',
-      '</div>'
-    ].join("\n")),
+      '</div>',
+    ].join('\n')),
     events: {},
     getValueFromDOM: function() {
-      return this.formatter.toRaw(this.$el.find("span").text(), this.model);
-    }
+      return this.formatter.toRaw(this.$el.find('span').text(), this.model);
+    },
   });
 
   /*
@@ -393,7 +374,7 @@
     Backform.RadioControl.prototype, {
       updateInvalid: function() {
         var self = this,
-            errorModel = this.model.errorModel;
+          errorModel = this.model.errorModel;
 
         if (!(errorModel instanceof Backbone.Model)) return this;
 
@@ -403,38 +384,35 @@
          * Find input which have name attribute.
          */
         this.$el.find(':input[name]').not('button').each(function(ix, el) {
-          var attrArr = $(el).attr('name').split('.'),
-              name = attrArr.shift(),
-              path = attrArr.join('.'),
-              error = self.keyPathAccessor(
-                errorModel.toJSON(), $(el).attr('name')
-              );
+          var error = self.keyPathAccessor(
+            errorModel.toJSON(), $(el).attr('name')
+          );
 
           if (_.isEmpty(error)) return;
 
           self.$el.addClass(Backform.errorClassName).find(
             '[type="radio"]'
           ).append(
-          $("<div></div>").addClass(
-            'pgadmin-control-error-message pg-el-xs-offset-4 pg-el-xs-8 pg-el-xs-8 help-block'
-          ).text(error));
+            $('<div></div>').addClass(
+              'pgadmin-control-error-message pg-el-xs-offset-4 pg-el-xs-8 pg-el-xs-8 help-block'
+            ).text(error));
         });
-      }
+      },
     });
 
   // Requires the Bootstrap Switch to work.
-  var SwitchControl = Backform.SwitchControl = Backform.InputControl.extend({
+  Backform.SwitchControl = Backform.InputControl.extend({
     defaults: {
-      label: "",
+      label: '',
       options: {
         onText: gettext('Yes'),
         offText: gettext('No'),
         onColor: 'success',
         offColor: 'primary',
-        size: 'small'
+        size: 'small',
       },
       extraClasses: [],
-      helpMessage: null
+      helpMessage: null,
     },
     template: _.template([
       '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
@@ -448,47 +426,51 @@
       '    <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
       '  <% } %>',
       '</div>',
-    ].join("\n")),
+    ].join('\n')),
     getValueFromDOM: function() {
       return this.formatter.toRaw(
-          this.$input.prop('checked'),
-          this.model
-          );
+        this.$input.prop('checked'),
+        this.model
+      );
+    },
+    events: {
+      'switchChange.bootstrapSwitch': 'onChange',
     },
-    events: {'switchChange.bootstrapSwitch': 'onChange'},
     render: function() {
       var field = _.defaults(this.field.toJSON(), this.defaults),
-          attributes = this.model.toJSON(),
-          attrArr = field.name.split('.'),
-          name = attrArr.shift(),
-          path = attrArr.join('.'),
-          rawValue = this.keyPathAccessor(attributes[name], path),
-          evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-            },
-          options = _.defaults({
-              disabled: evalF(field.disabled, field, this.model)
-            }, this.field.get('options'), this.defaults.options,
-            $.fn.bootstrapSwitch.defaults);
+        attributes = this.model.toJSON(),
+        attrArr = field.name.split('.'),
+        name = attrArr.shift(),
+        path = attrArr.join('.'),
+        rawValue = this.keyPathAccessor(attributes[name], path),
+        evalF = function(f, d, m) {
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        },
+        options = _.defaults({
+          disabled: evalF(field.disabled, field, this.model),
+        }, this.field.get('options'), this.defaults.options,
+          $.fn.bootstrapSwitch.defaults);
 
       Backform.InputControl.prototype.render.apply(this, arguments);
-      this.$input = this.$el.find("input[type=checkbox]").first();
+      this.$input = this.$el.find('input[type=checkbox]').first();
 
       //Check & set additional properties
       this.$input.bootstrapSwitch(
-          _.extend(options, {'state': rawValue})
-          );
+        _.extend(options, {
+          'state': rawValue,
+        })
+      );
 
       return this;
-    }
+    },
   });
 
   // Backform Dialog view (in bootstrap tabbular form)
   // A collection of field models.
-  var Dialog = Backform.Dialog = Backform.Form.extend({
+  Backform.Dialog = Backform.Form.extend({
     /* Array of objects having attributes [label, fields] */
     schema: undefined,
-    tagName: "div",
+    tagName: 'div',
     legend: true,
     className: function() {
       return 'pg-el-sm-12 pg-el-md-12 pg-el-lg-12 pg-el-xs-12';
@@ -520,10 +502,12 @@
         '<li role="presentation" <%=disabled ? "disabled" : ""%>>',
         ' <a data-toggle="tab" data-tab-index="<%=tabIndex%>" href="#<%=cId%>"',
         '  id="<%=hId%>" aria-controls="<%=cId%>">',
-        '<%=label%></a></li>'].join(" ")),
+        '<%=label%></a></li>',
+      ].join(' ')),
       'panel': _.template(
         '<div role="tabpanel" class="tab-pane <%=label%> pg-el-sm-12 pg-el-md-12 pg-el-lg-12 pg-el-xs-12 fade" id="<%=cId%>" aria-labelledby="<%=hId%>"></div>'
-      )},
+      ),
+    },
     render: function() {
       this.cleanup();
 
@@ -534,15 +518,15 @@
         controls = this.controls,
         tmpls = this.template,
         self = this,
-        idx=(this.tabIndex * 100),
+        idx = (this.tabIndex * 100),
         evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-          };
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        };
 
       this.$el
-          .empty()
-          .attr('role', 'tabpanel')
-          .attr('class', _.result(this, 'tabPanelClassName'));
+        .empty()
+        .attr('role', 'tabpanel')
+        .attr('class', _.result(this, 'tabPanelClassName'));
       m.panelEl = this.$el;
 
       var tabHead = $('<ul class="nav nav-tabs" role="tablist"></ul>')
@@ -555,17 +539,19 @@
         if (!o.version_compatible || !evalF(o.visible, o, m)) {
           return;
         }
-        var el = $((tmpls['panel'])(_.extend(o, {'tabIndex': idx})))
-              .appendTo(tabContent)
-              .removeClass('collapse').addClass('collapse'),
-            h = $((tmpls['header'])(o)).appendTo(tabHead);
+        var el = $((tmpls['panel'])(_.extend(o, {
+          'tabIndex': idx,
+        })))
+          .appendTo(tabContent)
+          .removeClass('collapse').addClass('collapse');
+        $((tmpls['header'])(o)).appendTo(tabHead);
 
         o.fields.each(function(f) {
-          var cntr = new (f.get("control")) ({
+          var cntr = new(f.get('control'))({
             field: f,
             model: m,
             dialog: self,
-            tabIndex: idx
+            tabIndex: idx,
           });
           el.append(cntr.render().$el);
           controls.push(cntr);
@@ -574,22 +560,25 @@
         tabHead.find('a[data-toggle="tab"]').off(
           'shown.bs.tab'
         ).off('hidden.bs.tab').on(
-          'hidden.bs.tab', function() {
+          'hidden.bs.tab',
+          function() {
             self.hidden_tab = $(this).data('tabIndex');
-            }).on('shown.bs.tab', function() {
-              var self = this;
-              self.shown_tab = $(self).data('tabIndex');
-              m.trigger('pg-property-tab-changed', {
-                'model': m, 'shown': self.shown_tab, 'hidden': self.hidden_tab,
-                'tab': self
-              });
+          }).on('shown.bs.tab', function() {
+            var self = this;
+            self.shown_tab = $(self).data('tabIndex');
+            m.trigger('pg-property-tab-changed', {
+              'model': m,
+              'shown': self.shown_tab,
+              'hidden': self.hidden_tab,
+              'tab': self,
             });
+          });
       });
 
       var makeActive = tabHead.find('[id="' + c + '"]').first();
       if (makeActive.length == 1) {
         makeActive.parent().addClass('active');
-        tabContent.find('#' + makeActive.attr("aria-controls"))
+        tabContent.find('#' + makeActive.attr('aria-controls'))
           .addClass('in active');
       } else {
         tabHead.find('[role="presentation"]').first().addClass('active');
@@ -602,29 +591,41 @@
       if (opts && opts.data) {
         if (this.model) {
           if (this.model.reset) {
-            this.model.reset({validate: false, silent: true, stop: true});
+            this.model.reset({
+              validate: false,
+              silent: true,
+              stop: true,
+            });
           }
-          this.model.clear({validate: false, silent: true, stop: true});
-          delete (this.model);
+          this.model.clear({
+            validate: false,
+            silent: true,
+            stop: true,
+          });
+          delete(this.model);
         }
         if (this.errorModel) {
-          this.errorModel.clear({validate: false, silent: true, stop: true});
-          delete (this.errorModel);
+          this.errorModel.clear({
+            validate: false,
+            silent: true,
+            stop: true,
+          });
+          delete(this.errorModel);
         }
       }
       this.cleanup();
       Backform.Form.prototype.remove.apply(this, arguments);
-    }
+    },
   });
 
-  var Fieldset = Backform.Fieldset = Backform.Dialog.extend({
+  Backform.Fieldset = Backform.Dialog.extend({
     className: function() {
       return 'set-group pg-el-xs-12';
     },
     tabPanelClassName: function() {
       return Backform.tabClassName;
     },
-    fieldsetClass:  Backform.setGroupClassName,
+    fieldsetClass: Backform.setGroupClassName,
     legendClass: 'badge',
     contentClass: Backform.setGroupContentClassName + ' collapse in',
     template: {
@@ -633,30 +634,31 @@
         ' <% if (legend != false) { %>',
         '  <legend class="<%=legendClass%>" <%=collapse ? "data-toggle=\'collapse\'" : ""%> data-target="#<%=cId%>"><%=collapse ? "<span class=\'caret\'></span>" : "" %><%=label%></legend>',
         ' <% } %>',
-        '</fieldset>'
-      ].join("\n")),
+        '</fieldset>',
+      ].join('\n')),
       'content': _.template(
         '  <div id="<%= cId %>" class="<%=contentClass%>"></div>'
-    )},
+      ),
+    },
     collapse: true,
     render: function() {
       this.cleanup();
 
       var m = this.model,
-          $el = this.$el,
-          tmpl = this.template,
-          controls = this.controls,
-          data = {
-            'className': _.result(this, 'className'),
-            'fieldsetClass': _.result(this, 'fieldsetClass'),
-            'legendClass': _.result(this, 'legendClass'),
-            'contentClass': _.result(this, 'contentClass'),
-            'collapse': _.result(this, 'collapse')
-          },
-          idx=(this.tabIndex * 100),
-          evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-          };
+        $el = this.$el,
+        tmpl = this.template,
+        controls = this.controls,
+        data = {
+          'className': _.result(this, 'className'),
+          'fieldsetClass': _.result(this, 'fieldsetClass'),
+          'legendClass': _.result(this, 'legendClass'),
+          'contentClass': _.result(this, 'contentClass'),
+          'collapse': _.result(this, 'collapse'),
+        },
+        idx = (this.tabIndex * 100),
+        evalF = function(f, d, m) {
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        };
 
       this.$el.empty();
 
@@ -670,14 +672,14 @@
           return;
 
         var d = _.extend({}, data, o),
-            h = $((tmpl['header'])(d)).appendTo($el),
-            el = $((tmpl['content'])(d)).appendTo(h);
+          h = $((tmpl['header'])(d)).appendTo($el),
+          el = $((tmpl['content'])(d)).appendTo(h);
 
         o.fields.each(function(f) {
-          var cntr = new (f.get("control")) ({
+          var cntr = new(f.get('control'))({
             field: f,
             model: m,
-            tabIndex: idx
+            tabIndex: idx,
           });
           el.append(cntr.render().$el);
           controls.push(cntr);
@@ -687,18 +689,20 @@
       return this;
     },
     getValueFromDOM: function() {
-      return "";
+      return '';
     },
-    events: {}
+    events: {},
   });
 
-  var generateGridColumnsFromModel = Backform.generateGridColumnsFromModel =
+  Backform.generateGridColumnsFromModel =
     function(node_info, m, type, cols, node) {
-      var groups = Backform.generateViewSchema(node_info, m, type, node, true, true),
-          schema = [],
-          columns = [],
-          func,
-          idx = 0;
+      var groups = Backform.generateViewSchema(
+          node_info, m, type, node, true, true
+        ),
+        schema = [],
+        columns = [],
+        func,
+        idx = 0;
 
       // Create another array if cols is of type object & store its keys in that array,
       // If cols is object then chances that we have custom width class attached with in.
@@ -725,10 +729,11 @@
             f.headerCell = Backgrid.Extension.CustomHeaderCell;
           }
         };
-      } else if(_.isObject(cols)) {
+      } else if (_.isObject(cols)) {
         var tblCols = Object.keys(cols);
         func = function(f) {
-          var val = (f.name in cols) && cols[f.name];
+          var val = (f.name in cols) && cols[f.name],
+            i;
 
           if (_.isNull(val) || _.isUndefined(val)) {
             f.cell_priority = -1;
@@ -739,7 +744,7 @@
               f.cell_priority = val['index'];
               idx = (idx > val['index']) ? idx + 1 : val['index'];
             } else {
-              var i = _.indexOf(tblCols, f.name);
+              i = _.indexOf(tblCols, f.name);
               f.cell_priority = idx = ((i > idx) ? i : idx);
               idx = idx + 1;
             }
@@ -758,7 +763,7 @@
             }
           }
           if (_.isString(val)) {
-            var i = _.indexOf(tblCols, f.name);
+            i = _.indexOf(tblCols, f.name);
 
             f.cell_priority = idx = ((i > idx) ? i : idx);
             idx = idx + 1;
@@ -772,7 +777,7 @@
       }
 
       // Prepare columns for backgrid
-      _.each(groups, function(group, key) {
+      _.each(groups, function(group) {
         _.each(group.fields, function(f) {
           if (!f.cell) {
             return;
@@ -789,56 +794,57 @@
         'columns': _.sortBy(columns, function(c) {
           return c.cell_priority;
         }),
-        'schema': schema
+        'schema': schema,
       };
     };
 
-  var UniqueColCollectionControl = Backform.UniqueColCollectionControl = Backform.Control.extend({
+  Backform.UniqueColCollectionControl = Backform.Control.extend({
     initialize: function() {
-        Backform.Control.prototype.initialize.apply(this, arguments);
+      Backform.Control.prototype.initialize.apply(this, arguments);
 
-        var uniqueCol = this.field.get('uniqueCol') || [],
-            m = this.field.get('model'),
-            schema = m.prototype.schema || m.__super__.schema,
-            columns = [],
-            self = this;
+      var uniqueCol = this.field.get('uniqueCol') || [],
+        m = this.field.get('model'),
+        schema = m.prototype.schema || m.__super__.schema,
+        columns = [],
+        self = this;
 
-        _.each(schema, function(s) {
-          columns.push(s.id);
-        });
+      _.each(schema, function(s) {
+        columns.push(s.id);
+      });
 
-        // Check if unique columns provided are also in model attributes.
-        if (uniqueCol.length > _.intersection(columns, uniqueCol).length) {
-            var errorMsg = "Developer: Unique columns [ "+_.difference(uniqueCol, columns)+" ] not found in collection model [ " + columns +" ]."
-            alert (errorMsg);
-        }
+      // Check if unique columns provided are also in model attributes.
+      if (uniqueCol.length > _.intersection(columns, uniqueCol).length) {
+        var errorMsg = 'Developer: Unique columns [ ' + _.difference(uniqueCol, columns) + ' ] not found in collection model [ ' + columns + ' ].';
+        alert(errorMsg);
+      }
 
-        var collection = self.collection = self.model.get(self.field.get('name'));
-
-        if (!collection) {
-          collection = self.collection = new (pgAdmin.Browser.Node.Collection)(
-              null,
-              {
-                model: self.field.get('model'),
-                silent: true,
-                handler: self.model,
-                top: self.model.top || self.model,
-                attrName: self.field.get('name')
-              });
-          self.model.set(self.field.get('name'), collection, {silent: true});
-        }
+      var collection = self.collection = self.model.get(self.field.get('name'));
 
-        if (this.field.get('version_compatible')) {
-          self.listenTo(collection, "add", self.collectionChanged);
-          self.listenTo(collection, "change", self.collectionChanged);
-        }
+      if (!collection) {
+        collection = self.collection = new(pgAdmin.Browser.Node.Collection)(
+          null, {
+            model: self.field.get('model'),
+            silent: true,
+            handler: self.model,
+            top: self.model.top || self.model,
+            attrName: self.field.get('name'),
+          });
+        self.model.set(self.field.get('name'), collection, {
+          silent: true,
+        });
+      }
+
+      if (this.field.get('version_compatible')) {
+        self.listenTo(collection, 'add', self.collectionChanged);
+        self.listenTo(collection, 'change', self.collectionChanged);
+      }
     },
     cleanup: function() {
-      this.stopListening(this.collection, "change", this.collectionChanged);
+      this.stopListening(this.collection, 'change', this.collectionChanged);
 
       if (this.field.get('version_compatible')) {
-        this.stopListening(self.collection, "add", this.collectionChanged);
-        this.stopListening(self.collection, "change", this.collectionChanged);
+        this.stopListening(self.collection, 'add', this.collectionChanged);
+        this.stopListening(self.collection, 'change', this.collectionChanged);
       }
       if (this.grid) {
         this.grid.remove();
@@ -848,36 +854,35 @@
     },
     collectionChanged: function(newModel, coll, op) {
       var uniqueCol = this.field.get('uniqueCol') || [],
-          uniqueChangedAttr = [],
-          self = this;
+        uniqueChangedAttr = [],
+        self = this;
       // Check if changed model attributes are also in unique columns. And then only check for uniqueness.
       if (newModel.attributes) {
         _.each(uniqueCol, function(col) {
-            if (_.has(newModel.attributes,col))
-            {
-               uniqueChangedAttr.push(col);
-            }
+          if (_.has(newModel.attributes, col)) {
+            uniqueChangedAttr.push(col);
+          }
         });
-        if(uniqueChangedAttr.length == 0) {
-            return;
+        if (uniqueChangedAttr.length == 0) {
+          return;
         }
       } else {
         return;
       }
 
       var collection = this.model.get(this.field.get('name'));
-      this.stopListening(collection, "change", this.collectionChanged);
+      this.stopListening(collection, 'change', this.collectionChanged);
       // Check if changed attribute's value of new/updated model also exist for another model in collection.
       // If duplicate value exists then set the attribute's value of new/updated model to its previous values.
       var m = undefined,
-          oldModel = undefined;
+        oldModel = undefined;
       collection.each(function(model) {
         if (newModel != model) {
-          var duplicateAttrValues = []
+          var duplicateAttrValues = [];
           _.each(uniqueCol, function(attr) {
             var attrValue = newModel.get(attr);
             if (!_.isUndefined(attrValue) && attrValue == model.get(attr)) {
-              duplicateAttrValues.push(attrValue)
+              duplicateAttrValues.push(attrValue);
             }
           });
           if (duplicateAttrValues.length == uniqueCol.length) {
@@ -906,16 +911,16 @@
           var idx = collection.indexOf(oldModel);
           if (idx > -1) {
             var newRow = self.grid.body.rows[idx].$el;
-            newRow.addClass("new");
+            newRow.addClass('new');
             $(newRow).pgMakeVisible('backform-tab');
             setTimeout(function() {
-              newRow.removeClass("new");
-              }, 3000);
+              newRow.removeClass('new');
+            }, 3000);
           }
         }
       }
 
-      this.listenTo(collection, "change", this.collectionChanged);
+      this.listenTo(collection, 'change', this.collectionChanged);
     },
     render: function() {
       // Clean up existing elements
@@ -924,36 +929,38 @@
       this.$el.empty();
 
       var field = _.defaults(this.field.toJSON(), this.defaults),
-          attributes = this.model.toJSON(),
-          attrArr = field.name.split('.'),
-          name = attrArr.shift(),
-          path = attrArr.join('.'),
-          rawValue = this.keyPathAccessor(attributes[name], path),
-          data = _.extend(field, {
-            rawValue: rawValue,
-            value: this.formatter.fromRaw(rawValue, this.model),
-            attributes: attributes,
-            formatter: this.formatter
-           }),
-          evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-          };
+        attributes = this.model.toJSON(),
+        attrArr = field.name.split('.'),
+        name = attrArr.shift(),
+        path = attrArr.join('.'),
+        rawValue = this.keyPathAccessor(attributes[name], path),
+        data = _.extend(field, {
+          rawValue: rawValue,
+          value: this.formatter.fromRaw(rawValue, this.model),
+          attributes: attributes,
+          formatter: this.formatter,
+        }),
+        evalF = function(f, d, m) {
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        };
 
       // Evaluate the disabled, visible, required, canAdd, & canDelete option
       _.extend(data, {
         disabled: (field.version_compatible &&
-                   evalF.apply(this.field, [data.disabled, data, this.model])
-                   ),
-        visible:  evalF.apply(this.field, [data.visible, data, this.model]),
+          evalF.apply(this.field, [data.disabled, data, this.model])
+        ),
+        visible: evalF.apply(this.field, [data.visible, data, this.model]),
         required: evalF.apply(this.field, [data.required, data, this.model]),
         canAdd: (field.version_compatible &&
           evalF.apply(this.field, [data.canAdd, data, this.model])
-          ),
+        ),
         canAddRow: data.canAddRow,
         canDelete: evalF.apply(this.field, [data.canDelete, data, this.model]),
-        canEdit: evalF.apply(this.field, [data.canEdit, data, this.model])
+        canEdit: evalF.apply(this.field, [data.canEdit, data, this.model]),
+      });
+      _.extend(data, {
+        add_label: '',
       });
-      _.extend(data, {add_label: ""});
 
       // This control is not visible, we should remove it.
       if (!data.visible) {
@@ -973,14 +980,15 @@
     },
     showGridControl: function(data) {
       var self = this,
-          gridHeader = _.template([
+        gridHeader = _.template([
           '<div class="subnode-header">',
           '  <label class="control-label pg-el-sm-10"><%-label%></label>',
           '  <button class="btn-sm btn-default add fa fa-plus" <%=canAdd ? "" : "disabled=\'disabled\'"%>><%-add_label%></button>',
-          '</div>'].join("\n")),
+          '</div>',
+        ].join('\n')),
         gridBody = $('<div class="pgadmin-control-group backgrid form-group pg-el-xs-12 object subnode"></div>').append(
-            gridHeader(data)
-            );
+          gridHeader(data)
+        );
 
       // Clean up existing grid if any (in case of re-render)
       if (self.grid) {
@@ -992,35 +1000,40 @@
       }
 
       var subnode = data.subnode.schema ? data.subnode : data.subnode.prototype,
-          gridSchema = Backform.generateGridColumnsFromModel(
-            data.node_info, subnode, this.field.get('mode'), data.columns
-            );
+        gridSchema = Backform.generateGridColumnsFromModel(
+          data.node_info, subnode, this.field.get('mode'), data.columns
+        );
 
       // Set visibility of Add button
       if (data.mode == 'properties') {
-        $(gridBody).find("button.add").remove();
+        $(gridBody).find('button.add').remove();
       }
 
       // Insert Delete Cell into Grid
       if (!data.disabled && data.canDelete) {
-          gridSchema.columns.unshift({
-            name: "pg-backform-delete", label: "",
-            cell: Backgrid.Extension.DeleteCell,
-            editable: false, cell_priority: -1,
-            canDeleteRow: data.canDeleteRow
-          });
+        gridSchema.columns.unshift({
+          name: 'pg-backform-delete',
+          label: '',
+          cell: Backgrid.Extension.DeleteCell,
+          editable: false,
+          cell_priority: -1,
+          canDeleteRow: data.canDeleteRow,
+        });
       }
 
       // Insert Edit Cell into Grid
       if (data.disabled == false && data.canEdit) {
-          var editCell = Backgrid.Extension.ObjectCell.extend({
-            schema: gridSchema.schema
-          });
+        var editCell = Backgrid.Extension.ObjectCell.extend({
+          schema: gridSchema.schema,
+        });
 
-          gridSchema.columns.unshift({
-            name: "pg-backform-edit", label: "", cell : editCell,
-            cell_priority: -2, canEditRow: data.canEditRow
-          });
+        gridSchema.columns.unshift({
+          name: 'pg-backform-edit',
+          label: '',
+          cell: editCell,
+          cell_priority: -2,
+          canEditRow: data.canEditRow,
+        });
       }
 
       var collection = this.model.get(data.name);
@@ -1029,30 +1042,30 @@
         var that = this,
           cell = args[0];
         // Search for any other rows which are open.
-        this.each(function(m){
+        this.each(function(m) {
           // Check if row which we are about to close is not current row.
           if (cell.model != m) {
             var idx = that.indexOf(m);
             if (idx > -1) {
               var row = self.grid.body.rows[idx],
-                  editCell = row.$el.find(".subnode-edit-in-process").parent();
+                editCell = row.$el.find('.subnode-edit-in-process').parent();
               // Only close row if it's open.
-              if (editCell.length > 0){
+              if (editCell.length > 0) {
                 var event = new Event('click');
                 editCell[0].dispatchEvent(event);
               }
             }
           }
         });
-      }
+      };
       // Listen for any row which is about to enter in edit mode.
-      collection.on( "enteringEditMode", cellEditing, collection);
+      collection.on('enteringEditMode', cellEditing, collection);
 
       // Initialize a new Grid instance
-      var grid = self.grid = new Backgrid.Grid({
+      self.grid = new Backgrid.Grid({
         columns: gridSchema.columns,
         collection: collection,
-        className: "backgrid table-bordered"
+        className: 'backgrid table-bordered',
       });
 
       // Render subNode grid
@@ -1060,66 +1073,66 @@
 
       // Combine Edit and Delete Cell
       if (data.canDelete && data.canEdit) {
-        $(subNodeGrid).find("th.pg-backform-delete").remove();
-        $(subNodeGrid).find("th.pg-backform-edit").attr("colspan", "2");
+        $(subNodeGrid).find('th.pg-backform-delete').remove();
+        $(subNodeGrid).find('th.pg-backform-edit').attr('colspan', '2');
       }
 
-      var $dialog =  gridBody.append(subNodeGrid);
+      var $dialog = gridBody.append(subNodeGrid);
 
       // Add button callback
       if (!(data.disabled || data.canAdd == false)) {
         $dialog.find('button.add').first().click(function(e) {
           e.preventDefault();
           var canAddRow = _.isFunction(data.canAddRow) ?
-                            data.canAddRow.apply(self, [self.model]) : true;
+            data.canAddRow.apply(self, [self.model]) : true;
           if (canAddRow) {
-              // Close any existing expanded row before adding new one.
-              _.each(self.grid.body.rows, function(row){
-                var editCell = row.$el.find(".subnode-edit-in-process").parent();
-                // Only close row if it's open.
-                if (editCell.length > 0){
-                  var event = new Event('click');
-                  editCell[0].dispatchEvent(event);
-                }
-              });
+            // Close any existing expanded row before adding new one.
+            _.each(self.grid.body.rows, function(row) {
+              var editCell = row.$el.find('.subnode-edit-in-process').parent();
+              // Only close row if it's open.
+              if (editCell.length > 0) {
+                var event = new Event('click');
+                editCell[0].dispatchEvent(event);
+              }
+            });
 
-              var allowMultipleEmptyRows = !!self.field.get('allowMultipleEmptyRows');
-
-              // If allowMultipleEmptyRows is not set or is false then don't allow second new empty row.
-              // There should be only one empty row.
-              if (!allowMultipleEmptyRows && collection) {
-                var isEmpty = false;
-                collection.each(function(model) {
-                  var modelValues = [];
-                  _.each(model.attributes, function(val, key) {
-                    modelValues.push(val);
-                  })
-                  if(!_.some(modelValues, _.identity)) {
-                    isEmpty = true;
-                  }
+            var allowMultipleEmptyRows = !!self.field.get('allowMultipleEmptyRows');
+
+            // If allowMultipleEmptyRows is not set or is false then don't allow second new empty row.
+            // There should be only one empty row.
+            if (!allowMultipleEmptyRows && collection) {
+              var isEmpty = false;
+              collection.each(function(model) {
+                var modelValues = [];
+                _.each(model.attributes, function(val) {
+                  modelValues.push(val);
                 });
-                if(isEmpty) {
-                  return false;
+                if (!_.some(modelValues, _.identity)) {
+                  isEmpty = true;
                 }
+              });
+              if (isEmpty) {
+                return false;
               }
+            }
 
-              $(self.grid.body.$el.find($("tr.new"))).removeClass("new")
-              var m = new (data.model) (null, {
-                silent: true,
-                handler: collection,
-                top: self.model.top || self.model,
-                collection: collection,
-                node_info: self.model.node_info
-              });
-              collection.add(m);
+            $(self.grid.body.$el.find($('tr.new'))).removeClass('new');
+            var m = new(data.model)(null, {
+              silent: true,
+              handler: collection,
+              top: self.model.top || self.model,
+              collection: collection,
+              node_info: self.model.node_info,
+            });
+            collection.add(m);
 
-              var idx = collection.indexOf(m),
-                  newRow = self.grid.body.rows[idx].$el;
+            var idx = collection.indexOf(m),
+              newRow = self.grid.body.rows[idx].$el;
 
-              newRow.addClass("new");
-              $(newRow).pgMakeVisible('backform-tab');
+            newRow.addClass('new');
+            $(newRow).pgMakeVisible('backform-tab');
 
-              return false;
+            return false;
           }
         });
       }
@@ -1127,61 +1140,65 @@
       return $dialog;
     },
     clearInvalid: function() {
-      this.$el.removeClass("subnode-error");
-      this.$el.find(".pgadmin-control-error-message").remove();
+      this.$el.removeClass('subnode-error');
+      this.$el.find('.pgadmin-control-error-message').remove();
       return this;
     },
     updateInvalid: function() {
       var self = this,
-      errorModel = this.model.errorModel;
+        errorModel = this.model.errorModel;
 
       if (!(errorModel instanceof Backbone.Model)) return this;
 
       this.clearInvalid();
 
-      this.$el.find('.subnode-body').each(function(ix, el) {
-        var error = self.keyPathAccessor(errorModel.toJSON(), self.field.get('name'));
+      this.$el.find('.subnode-body').each(function() {
+        var error = self.keyPathAccessor(
+          errorModel.toJSON(), self.field.get('name')
+        );
 
         if (_.isEmpty(error)) return;
 
-        self.$el.addClass("subnode-error").append(
-          $("<div></div>").addClass('pgadmin-control-error-message pg-el-xs-offset-4 pg-el-xs-8 help-block').text(error)
-          );
+        self.$el.addClass('subnode-error').append(
+          $('<div></div>').addClass(
+            'pgadmin-control-error-message pg-el-xs-offset-4 pg-el-xs-8 help-block'
+          ).text(error)
+        );
       });
-    }
+    },
   });
 
-  var SubNodeCollectionControl = Backform.SubNodeCollectionControl = Backform.Control.extend({
+  Backform.SubNodeCollectionControl = Backform.Control.extend({
     row: Backgrid.Row,
     render: function() {
       var field = _.defaults(this.field.toJSON(), this.defaults),
-          attributes = this.model.toJSON(),
-          attrArr = field.name.split('.'),
-          name = attrArr.shift(),
-          path = attrArr.join('.'),
-          rawValue = this.keyPathAccessor(attributes[name], path),
-          data = _.extend(field, {
-            rawValue: rawValue,
-            value: this.formatter.fromRaw(rawValue, this.model),
-            attributes: attributes,
-            formatter: this.formatter
-           }),
-          evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-          };
+        attributes = this.model.toJSON(),
+        attrArr = field.name.split('.'),
+        name = attrArr.shift(),
+        path = attrArr.join('.'),
+        rawValue = this.keyPathAccessor(attributes[name], path),
+        data = _.extend(field, {
+          rawValue: rawValue,
+          value: this.formatter.fromRaw(rawValue, this.model),
+          attributes: attributes,
+          formatter: this.formatter,
+        }),
+        evalF = function(f, d, m) {
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        };
 
       // Evaluate the disabled, visible, required, canAdd, cannEdit & canDelete option
       _.extend(data, {
         disabled: evalF(data.disabled, data, this.model),
-        visible:  evalF(data.visible, data, this.model),
+        visible: evalF(data.visible, data, this.model),
         required: evalF(data.required, data, this.model),
         canAdd: evalF(data.canAdd, data, this.model),
         canAddRow: data.canAddRow,
         canEdit: evalF(data.canEdit, data, this.model),
-        canDelete: evalF(data.canDelete, data, this.model)
+        canDelete: evalF(data.canDelete, data, this.model),
       });
       // Show Backgrid Control
-      var grid = (data.subnode == undefined) ? "" : this.showGridControl(data);
+      var grid = (data.subnode == undefined) ? '' : this.showGridControl(data);
 
       // Clean up first
       this.$el.removeClass(Backform.hiddenClassName);
@@ -1202,15 +1219,14 @@
       this.clearInvalid();
 
       var attrArr = self.field.get('name').split('.'),
-        name = attrArr.shift(),
         path = attrArr.join('.'),
         error = self.keyPathAccessor(errorModel.toJSON(), path);
 
       if (_.isEmpty(error)) return;
 
       self.$el.addClass('subnode-error').append(
-        $("<div></div>").addClass('pgadmin-control-error-message pg-el-xs-offset-4 pg-el-xs-8 help-block').text(error)
-        );
+        $('<div></div>').addClass('pgadmin-control-error-message pg-el-xs-offset-4 pg-el-xs-8 help-block').text(error)
+      );
     },
     cleanup: function() {
       // Clean up existing grid if any (in case of re-render)
@@ -1218,27 +1234,28 @@
         this.grid.remove();
       }
       if (this.collection) {
-        this.collection.off( "enteringEditMode");
+        this.collection.off('enteringEditMode');
       }
     },
     clearInvalid: function() {
       this.$el.removeClass('subnode-error');
-      this.$el.find(".pgadmin-control-error-message").remove();
+      this.$el.find('.pgadmin-control-error-message').remove();
       return this;
     },
     showGridControl: function(data) {
       var self = this,
-          gridHeader = ["<div class='subnode-header'>",
-          "  <label class='control-label pg-el-sm-10'>" + data.label + "</label>" ,
-          "  <button class='btn-sm btn-default add fa fa-plus'></button>",
-          "</div>"].join("\n"),
-        gridBody = $("<div class='pgadmin-control-group backgrid form-group pg-el-xs-12 object subnode'></div>").append(gridHeader);
+        gridHeader = ['<div class=\'subnode-header\'>',
+          '  <label class=\'control-label pg-el-sm-10\'>' + data.label + '</label>',
+          '  <button class=\'btn-sm btn-default add fa fa-plus\'></button>',
+          '</div>',
+        ].join('\n'),
+        gridBody = $('<div class=\'pgadmin-control-group backgrid form-group pg-el-xs-12 object subnode\'></div>').append(gridHeader);
 
       var subnode = data.subnode.schema ? data.subnode : data.subnode.prototype,
-          gridSchema = Backform.generateGridColumnsFromModel(
-            data.node_info, subnode, this.field.get('mode'), data.columns, data.schema_node
-            ),
-          pgBrowser = window.pgAdmin.Browser;
+        gridSchema = Backform.generateGridColumnsFromModel(
+          data.node_info, subnode, this.field.get('mode'), data.columns, data.schema_node
+        ),
+        pgBrowser = window.pgAdmin.Browser;
 
       // Clean up existing grid if any (in case of re-render)
       if (self.grid) {
@@ -1247,76 +1264,84 @@
 
       // Set visibility of Add button
       if (data.disabled || data.canAdd == false) {
-        $(gridBody).find("button.add").remove();
+        $(gridBody).find('button.add').remove();
       }
 
       // Insert Delete Cell into Grid
       if (data.disabled == false && data.canDelete) {
-          gridSchema.columns.unshift({
-            name: "pg-backform-delete", label: "",
-            cell: Backgrid.Extension.DeleteCell,
-            editable: false, cell_priority: -1,
-            canDeleteRow: data.canDeleteRow,
-            customDeleteMsg: data.customDeleteMsg,
-            customDeleteTitle: data.customDeleteTitle
-          });
+        gridSchema.columns.unshift({
+          name: 'pg-backform-delete',
+          label: '',
+          cell: Backgrid.Extension.DeleteCell,
+          editable: false,
+          cell_priority: -1,
+          canDeleteRow: data.canDeleteRow,
+          customDeleteMsg: data.customDeleteMsg,
+          customDeleteTitle: data.customDeleteTitle,
+        });
       }
 
       // Insert Edit Cell into Grid
       if (data.disabled == false && data.canEdit) {
-          var editCell = Backgrid.Extension.ObjectCell.extend({
-            schema: gridSchema.schema
+        var editCell = Backgrid.Extension.ObjectCell.extend({
+            schema: gridSchema.schema,
           }),
           canEdit = self.field.has('canEdit') &&
           self.field.get('canEdit') || true;
 
-          gridSchema.columns.unshift({
-            name: "pg-backform-edit", label: "", cell : editCell,
-            cell_priority: -2, editable: canEdit,
-            canEditRow: data.canEditRow
-          });
+        gridSchema.columns.unshift({
+          name: 'pg-backform-edit',
+          label: '',
+          cell: editCell,
+          cell_priority: -2,
+          editable: canEdit,
+          canEditRow: data.canEditRow,
+        });
       }
 
       var collection = self.model.get(data.name);
 
       if (!collection) {
-        collection = new (pgBrowser.Node.Collection)(null, {
+        collection = new(pgBrowser.Node.Collection)(null, {
           handler: self.model.handler || self.model,
-          model: data.model, top: self.model.top || self.model,
-          silent: true
+          model: data.model,
+          top: self.model.top || self.model,
+          silent: true,
+        });
+        self.model.set(data.name, collection, {
+          silent: true,
         });
-        self.model.set(data.name, collection, {silent: true});
       }
 
       var cellEditing = function(args) {
         var self = this,
           cell = args[0];
         // Search for any other rows which are open.
-        this.each(function(m){
+        this.each(function(m) {
           // Check if row which we are about to close is not current row.
           if (cell.model != m) {
             var idx = self.indexOf(m);
             if (idx > -1) {
               var row = grid.body.rows[idx],
-                  editCell = row.$el.find(".subnode-edit-in-process").parent();
+                editCell = row.$el.find('.subnode-edit-in-process').parent();
               // Only close row if it's open.
-              if (editCell.length > 0){
+              if (editCell.length > 0) {
                 var event = new Event('click');
                 editCell[0].dispatchEvent(event);
               }
             }
           }
         });
-      }
+      };
       // Listen for any row which is about to enter in edit mode.
-      collection.on( "enteringEditMode", cellEditing, collection);
+      collection.on('enteringEditMode', cellEditing, collection);
 
       // Initialize a new Grid instance
       var grid = self.grid = new Backgrid.Grid({
-          columns: gridSchema.columns,
-          collection: collection,
-          row: this.row,
-          className: "backgrid table-bordered"
+        columns: gridSchema.columns,
+        collection: collection,
+        row: this.row,
+        className: 'backgrid table-bordered',
       });
 
       // Render subNode grid
@@ -1324,23 +1349,23 @@
 
       // Combine Edit and Delete Cell
       if (data.canDelete && data.canEdit) {
-        $(subNodeGrid).find("th.pg-backform-delete").remove();
-        $(subNodeGrid).find("th.pg-backform-edit").attr("colspan", "2");
+        $(subNodeGrid).find('th.pg-backform-delete').remove();
+        $(subNodeGrid).find('th.pg-backform-edit').attr('colspan', '2');
       }
 
-      var $dialog =  gridBody.append(subNodeGrid);
+      var $dialog = gridBody.append(subNodeGrid);
 
       // Add button callback
       $dialog.find('button.add').click(function(e) {
-         e.preventDefault();
+        e.preventDefault();
         var canAddRow = _.isFunction(data.canAddRow) ?
-                            data.canAddRow.apply(self, [self.model]) : true;
+          data.canAddRow.apply(self, [self.model]) : true;
         if (canAddRow) {
           // Close any existing expanded row before adding new one.
-          _.each(grid.body.rows, function(row){
-            var editCell = row.$el.find(".subnode-edit-in-process").parent();
+          _.each(grid.body.rows, function(row) {
+            var editCell = row.$el.find('.subnode-edit-in-process').parent();
             // Only close row if it's open.
-            if (editCell.length > 0){
+            if (editCell.length > 0) {
               var event = new Event('click');
               editCell[0].dispatchEvent(event);
             }
@@ -1349,8 +1374,8 @@
           grid.insertRow({});
 
           var newRow = $(grid.body.rows[collection.length - 1].$el);
-          newRow.attr("class", "new").click(function(e) {
-            $(this).attr("class", "editable");
+          newRow.attr('class', 'new').click(function() {
+            $(this).attr('class', 'editable');
           });
           $(newRow).pgMakeVisible('backform-tab');
           return false;
@@ -1358,7 +1383,7 @@
       });
 
       return $dialog;
-    }
+    },
   });
 
   /*
@@ -1368,12 +1393,12 @@
    * When the user clicks on the SQL tab, we will send the modified data to the
    * server and fetch the SQL for it.
    */
-  var SqlTabControl = Backform.SqlTabControl = Backform.Control.extend({
+  Backform.SqlTabControl = Backform.Control.extend({
     defaults: {
-      label: "",
-      controlsClassName: "pgadmin-controls pg-el-sm-12 SQL",
+      label: '',
+      controlsClassName: 'pgadmin-controls pg-el-sm-12 SQL',
       extraClasses: [],
-      helpMessage: null
+      helpMessage: null,
     },
     template: _.template([
       '<div class="<%=controlsClassName%>">',
@@ -1381,8 +1406,8 @@
       '  <% if (helpMessage && helpMessage.length) { %>',
       '    <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
       '  <% } %>',
-      '</div>'
-    ].join("\n")),
+      '</div>',
+    ].join('\n')),
     /*
      * Initialize the SQL Tab control properly
      */
@@ -1396,7 +1421,7 @@
       _.bindAll(this, 'onTabChange', 'onPanelResized');
     },
     getValueFromDOM: function() {
-        return this.formatter.toRaw(this.$el.find("textarea").val(), this.model);
+      return this.formatter.toRaw(this.$el.find('textarea').val(), this.model);
     },
     render: function() {
       if (this.sqlCtrl) {
@@ -1411,17 +1436,16 @@
       Backform.Control.prototype.render.apply(this, arguments);
 
       this.sqlCtrl = CodeMirror.fromTextArea(
-        (this.$el.find("textarea")[0]), {
-        lineNumbers: true,
-        lineWrapping: true,
-        mode: "text/x-pgsql",
-        readOnly: true,
-        extraKeys: pgAdmin.Browser.editor_shortcut_keys,
-        tabSize: pgAdmin.Browser.editor_options.tabSize,
-        lineWrapping: pgAdmin.Browser.editor_options.wrapCode,
-        autoCloseBrackets: pgAdmin.Browser.editor_options.insert_pair_brackets,
-        matchBrackets: pgAdmin.Browser.editor_options.brace_matching
-      });
+        (this.$el.find('textarea')[0]), {
+          lineNumbers: true,
+          mode: 'text/x-pgsql',
+          readOnly: true,
+          extraKeys: pgAdmin.Browser.editor_shortcut_keys,
+          tabSize: pgAdmin.Browser.editor_options.tabSize,
+          lineWrapping: pgAdmin.Browser.editor_options.wrapCode,
+          autoCloseBrackets: pgAdmin.Browser.editor_options.insert_pair_brackets,
+          matchBrackets: pgAdmin.Browser.editor_options.brace_matching,
+        });
 
       /*
        * We will listen to the tab change event to check, if the SQL tab has
@@ -1439,17 +1463,17 @@
 
         // We will send a request to the sever only if something has changed
         // in a model and also it does not contain any error.
-        if(this.model.sessChanged()) {
+        if (this.model.sessChanged()) {
           if (_.size(this.model.errorModel.attributes) == 0) {
             var self = this,
-                node = self.field.get('schema_node'),
-                msql_url = node.generate_url.apply(
-                  node, [
-                    null, 'msql', this.field.get('node_data'), !self.model.isNew(),
-                    this.field.get('node_info')
-                  ]);
-
-                  // Fetching the modified SQL
+              node = self.field.get('schema_node'),
+              msql_url = node.generate_url.apply(
+                node, [
+                  null, 'msql', this.field.get('node_data'), !self.model.isNew(),
+                  this.field.get('node_info'),
+                ]);
+
+            // Fetching the modified SQL
             self.model.trigger('pgadmin-view:msql:fetching', self.method, node);
 
             $.ajax({
@@ -1457,8 +1481,8 @@
               type: 'GET',
               cache: false,
               data: self.model.toJSON(true, 'GET'),
-              dataType: "json",
-              contentType: "application/json"
+              dataType: 'json',
+              contentType: 'application/json',
             }).done(function(res) {
               self.sqlCtrl.clearHistory();
               self.sqlCtrl.setValue(res.data);
@@ -1481,16 +1505,16 @@
     onPanelResized: function(o) {
       if (o && o.container) {
         var $tabContent = o.container.find(
-              '.backform-tab > .tab-content'
-            ).first(),
-            $sqlPane = $tabContent.find(
-              'div[role=tabpanel].tab-pane.SQL'
-            );
+            '.backform-tab > .tab-content'
+          ).first(),
+          $sqlPane = $tabContent.find(
+            'div[role=tabpanel].tab-pane.SQL'
+          );
         if ($sqlPane.hasClass('active')) {
           $sqlPane.find('.CodeMirror').css(
             'cssText',
             'height: ' + ($tabContent.height() + 8) + 'px !important;'
-          )
+          );
         }
       }
     },
@@ -1506,20 +1530,20 @@
       this.model.off('pg-browser-resized', this.onPanelResized, this);
 
       Backform.Control.__super__.remove.apply(this, arguments);
-    }
-});
-   /*
+    },
+  });
+  /*
    * Numeric input Control functionality just like backgrid
    */
-  var NumericControl = Backform.NumericControl = Backform.InputControl.extend({
+  Backform.NumericControl = Backform.InputControl.extend({
     defaults: {
-      type: "number",
-      label: "",
+      type: 'number',
+      label: '',
       min: undefined,
       max: undefined,
       maxlength: 255,
       extraClasses: [],
-      helpMessage: null
+      helpMessage: null,
     },
     template: _.template([
       '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
@@ -1528,8 +1552,8 @@
       '  <% if (helpMessage && helpMessage.length) { %>',
       '    <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
       '  <% } %>',
-      '</div>'
-    ].join("\n"))
+      '</div>',
+    ].join('\n')),
   });
 
   ///////
@@ -1537,37 +1561,39 @@
   //
   // It will be used by the grid, properties, and dialog view generation
   // functions.
-  var generateViewSchema = Backform.generateViewSchema = function(
-      node_info, Model, mode, node, treeData, noSQL, subschema
-      ) {
+  Backform.generateViewSchema = function(
+    node_info, Model, mode, node, treeData, noSQL, subschema
+  ) {
     var proto = (Model && Model.prototype) || Model,
-        schema = subschema || (proto && proto.schema),
-        pgBrowser = window.pgAdmin.Browser, fields = [],
-        groupInfo = {};
+      schema = subschema || (proto && proto.schema),
+      pgBrowser = window.pgAdmin.Browser,
+      fields = [],
+      groupInfo = {};
 
     // 'schema' has the information about how to generate the form.
     if (schema && _.isArray(schema)) {
       var evalASFunc = evalASFunc = function(prop) {
         return ((prop && proto[prop] &&
-              typeof proto[prop] == "function") ? proto[prop] : prop);
+          typeof proto[prop] == 'function') ? proto[prop] : prop);
       };
       var groups = {},
-          server_info = node_info && ('server' in node_info) &&
-            pgBrowser.serverInfo && pgBrowser.serverInfo[node_info.server._id],
-          in_catalog = node_info && ('catalog' in node_info);
+        server_info = node_info && ('server' in node_info) &&
+        pgBrowser.serverInfo && pgBrowser.serverInfo[node_info.server._id],
+        in_catalog = node_info && ('catalog' in node_info),
+        ver_in_limit;
 
       _.each(schema, function(s) {
         // Do we understand - what control, we're creating
         // here?
         if (s.type == 'group') {
-          var ver_in_limit = (_.isUndefined(server_info) ? true :
-              ((_.isUndefined(s.server_type) ? true :
+          var visible = true;
+          ver_in_limit = (_.isUndefined(server_info) ? true :
+            ((_.isUndefined(s.server_type) ? true :
                 (server_info.type in s.server_type)) &&
               (_.isUndefined(s.min_version) ? true :
-               (server_info.version >= s.min_version)) &&
+                (server_info.version >= s.min_version)) &&
               (_.isUndefined(s.max_version) ? true :
-               (server_info.version <= s.max_version)))),
-              visible = true;
+                (server_info.version <= s.max_version))));
 
           if (s.mode && _.isObject(s.mode))
             visible = (_.indexOf(s.mode, mode) > -1);
@@ -1577,18 +1603,18 @@
           groupInfo[s.id] = {
             label: s.label || s.id,
             version_compatible: ver_in_limit,
-            visible: visible
+            visible: visible,
           };
           return;
         }
 
         if (!s.mode || (s && s.mode && _.isObject(s.mode) &&
-          _.indexOf(s.mode, mode) != -1)) {
+            _.indexOf(s.mode, mode) != -1)) {
           // Each field is kept in specified group, or in
           // 'General' category.
           var group = s.group || gettext('General'),
-              control = s.control || Backform.getMappedControl(s.type, mode),
-              cell =  s.cell || Backform.getMappedControl(s.type, 'cell');
+            control = s.control || Backform.getMappedControl(s.type, mode),
+            cell = s.cell || Backform.getMappedControl(s.type, 'cell');
 
           if (control == null) {
             return;
@@ -1596,16 +1622,19 @@
 
           // Generate the empty group list (if not exists)
           groups[group] = (groups[group] || []);
-          var ver_in_limit = (_.isUndefined(server_info) ? true :
-                ((_.isUndefined(s.server_type) ? true :
-                  (server_info.type in s.server_type)) &&
-                (_.isUndefined(s.min_version) ? true :
-                 (server_info.version >= s.min_version)) &&
-                (_.isUndefined(s.max_version) ? true :
-                 (server_info.version <= s.max_version)))),
-              disabled = ((mode == 'properties') || !ver_in_limit || in_catalog),
-              schema_node = (s.node && _.isString(s.node) &&
-                  s.node in pgBrowser.Nodes &&  pgBrowser.Nodes[s.node]) || node;
+          ver_in_limit = (_.isUndefined(server_info) ? true :
+            ((_.isUndefined(s.server_type) ? true :
+                (server_info.type in s.server_type)) &&
+              (_.isUndefined(s.min_version) ? true :
+                (server_info.version >= s.min_version)) &&
+              (_.isUndefined(s.max_version) ? true :
+                (server_info.version <= s.max_version))));
+
+          var disabled = (
+              (mode == 'properties') || !ver_in_limit || in_catalog
+            ),
+            schema_node = (s.node && _.isString(s.node) &&
+              s.node in pgBrowser.Nodes && pgBrowser.Nodes[s.node]) || node;
 
           var o = _.extend(_.clone(s), {
             name: s.id,
@@ -1613,9 +1642,9 @@
 
             disabled: (disabled ? true : evalASFunc(s.disabled)),
             editable: _.isUndefined(s.editable) ?
-                pgAdmin.editableCell : evalASFunc(s.editable),
+              pgAdmin.editableCell : evalASFunc(s.editable),
             subnode: ((_.isString(s.model) && s.model in pgBrowser.Nodes) ?
-                pgBrowser.Nodes[s.model].model : s.model),
+              pgBrowser.Nodes[s.model].model : s.model),
             canAdd: (disabled ? false : evalASFunc(s.canAdd)),
             canAddRow: (disabled ? false : evalASFunc(s.canAddRow)),
             canEdit: (disabled ? false : evalASFunc(s.canEdit)),
@@ -1632,7 +1661,7 @@
             visible: evalASFunc(s.visible),
             node: node,
             node_data: treeData,
-            version_compatible: ver_in_limit
+            version_compatible: ver_in_limit,
           });
           delete o.id;
 
@@ -1645,8 +1674,8 @@
             delete o.cell;
 
             o.schema = Backform.generateViewSchema(
-                node_info, Model, mode, node, treeData, true, s.schema
-                );
+              node_info, Model, mode, node, treeData, true, s.schema
+            );
             o.control = o.control || 'tab';
           }
         }
@@ -1660,14 +1689,14 @@
 
       if (!noSQL && node && node.hasSQL && (mode == 'create' || mode == 'edit')) {
         groups[gettext('SQL')] = [{
-            name: 'sql',
-            visible: true,
-            disabled: false,
-            type: 'text',
-            control: 'sql-tab',
-            node_info: node_info,
-            schema_node: node,
-            node_data: treeData
+          name: 'sql',
+          visible: true,
+          disabled: false,
+          type: 'text',
+          control: 'sql-tab',
+          node_info: node_info,
+          schema_node: node,
+          node_data: treeData,
         }];
       }
 
@@ -1677,10 +1706,16 @@
         fields.push(
           _.extend(
             _.defaults(
-              groupInfo[key] || {label: key},
-              {version_compatible: true, visible: true}
-            ), {fields: val})
-          );
+              groupInfo[key] || {
+                label: key,
+              }, {
+                version_compatible: true,
+                visible: true,
+              }
+            ), {
+              fields: val,
+            })
+        );
       });
     }
 
@@ -1689,32 +1724,32 @@
 
   var Select2Formatter = function() {};
   _.extend(Select2Formatter.prototype, {
-    fromRaw: function(rawData, model) {
+    fromRaw: function(rawData) {
       return encodeURIComponent(rawData);
     },
-    toRaw: function(formattedData, model) {
+    toRaw: function(formattedData) {
       if (_.isArray(formattedData)) {
         return _.map(formattedData, decodeURIComponent);
       } else {
-        if(!_.isNull(formattedData) && !_.isUndefined(formattedData)) {
+        if (!_.isNull(formattedData) && !_.isUndefined(formattedData)) {
           return decodeURIComponent(formattedData);
         } else {
           return null;
         }
       }
-    }
+    },
   });
 
   /*
    *  Backform Select2 control.
    */
-  var Select2Control = Backform.Select2Control = Backform.SelectControl.extend({
+  Backform.Select2Control = Backform.SelectControl.extend({
     defaults: _.extend({}, Backform.SelectControl.prototype.defaults, {
       select2: {
         first_empty: true,
         multiple: false,
-        emptyOptions: false
-      }
+        emptyOptions: false,
+      },
     }),
     formatter: Select2Formatter,
     template: _.template([
@@ -1739,52 +1774,52 @@
       ' <% if (helpMessage && helpMessage.length) { %>',
       ' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
       ' <% } %>',
-      '</div>'
-    ].join("\n")),
+      '</div>',
+    ].join('\n')),
     render: function() {
 
-      if(this.$sel && this.$sel.select2 &&
+      if (this.$sel && this.$sel.select2 &&
         this.$sel.select2.hasOwnProperty('destroy')) {
         this.$sel.select2('destroy');
       }
 
       var field = _.defaults(this.field.toJSON(), this.defaults),
-          attributes = this.model.toJSON(),
-          attrArr = field.name.split('.'),
-          name = attrArr.shift(),
-          path = attrArr.join('.'),
-          rawValue = this.keyPathAccessor(attributes[name], path),
-          data = _.extend(field, {
-            rawValue: rawValue,
-            value: this.formatter.fromRaw(rawValue, this.model),
-            attributes: attributes,
-            formatter: this.formatter
-          }),
-          evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-          };
+        attributes = this.model.toJSON(),
+        attrArr = field.name.split('.'),
+        name = attrArr.shift(),
+        path = attrArr.join('.'),
+        rawValue = this.keyPathAccessor(attributes[name], path),
+        data = _.extend(field, {
+          rawValue: rawValue,
+          value: this.formatter.fromRaw(rawValue, this.model),
+          attributes: attributes,
+          formatter: this.formatter,
+        }),
+        evalF = function(f, d, m) {
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        };
 
       data.select2 = data.select2 || {};
       _.defaults(data.select2, this.defaults.select2, {
         first_empty: true,
         multiple: false,
-        emptyOptions: false
+        emptyOptions: false,
       });
 
       // Evaluate the disabled, visible, and required option
       _.extend(data, {
         disabled: evalF(data.disabled, data, this.model),
-        visible:  evalF(data.visible, data, this.model),
-        required: evalF(data.required, data, this.model)
+        visible: evalF(data.visible, data, this.model),
+        required: evalF(data.required, data, this.model),
       });
 
       // Evaluation the options
       if (_.isFunction(data.options)) {
         try {
-          data.options = data.options(this)
-        } catch(e) {
+          data.options = data.options(this);
+        } catch (e) {
           // Do nothing
-          data.options = []
+          data.options = [];
           this.model.trigger(
             'pgadmin-view:transform:error', this.model, this.field, e
           );
@@ -1800,13 +1835,13 @@
       this.$el.html(this.template(data)).addClass(field.name);
 
       var select2Opts = _.extend({
-              disabled: data.disabled
-            }, field.select2, {
-                options: (this.field.get('options') || this.defaults.options)
-            });
+        disabled: data.disabled,
+      }, field.select2, {
+        options: (this.field.get('options') || this.defaults.options),
+      });
 
       // If disabled then no need to show placeholder
-      if(data.disabled || data.mode === 'properties') {
+      if (data.disabled || data.mode === 'properties') {
         select2Opts['placeholder'] = '';
       }
 
@@ -1819,7 +1854,7 @@
         select2Opts.data = data.rawValue;
       }
 
-      this.$sel = this.$el.find("select").select2(select2Opts);
+      this.$sel = this.$el.find('select').select2(select2Opts);
 
       // Add or remove tags from select2 control
       if (data.select2.tags && data.select2.emptyOptions) {
@@ -1827,7 +1862,7 @@
         this.$sel.trigger('change.select2');
         this.$sel.on('select2:unselect', function(evt) {
 
-          $(this).find('option[value="'+evt.params.data.text.replace("'","\\'").replace('"','\\"')+'"]').remove();
+          $(this).find('option[value="' + evt.params.data.text.replace('\'', '\\\'').replace('"', '\\"') + '"]').remove();
           $(this).trigger('change.select2');
           if ($(this).val() == null) {
             $(this).empty();
@@ -1839,7 +1874,7 @@
 
       // Select the highlighted item on Tab press.
       if (this.$sel) {
-        this.$sel.data('select2').on("keypress", function(ev) {
+        this.$sel.data('select2').on('keypress', function(ev) {
           var self = this;
 
           // keycode 9 is for TAB key
@@ -1856,25 +1891,27 @@
     },
     getValueFromDOM: function() {
       var val = Backform.SelectControl.prototype.getValueFromDOM.apply(
-                  this, arguments
-                ),
-        select2Opts = _.extend({}, this.field.get("select2") || this.defaults.select2);
+          this, arguments
+        ),
+        select2Opts = _.extend({}, this.field.get('select2') || this.defaults.select2);
 
       if (select2Opts.multiple && val == null) {
         return [];
       }
       return val;
-    }
+    },
   });
 
-  var FieldsetControl = Backform.FieldsetControl = Backform.Fieldset.extend({
+  Backform.FieldsetControl = Backform.Fieldset.extend({
     initialize: function(opts) {
       Backform.Control.prototype.initialize.apply(
         this, arguments
-        );
+      );
       Backform.Dialog.prototype.initialize.apply(
-        this, [{schema: opts.field.get('schema')}]
-        );
+        this, [{
+          schema: opts.field.get('schema'),
+        }]
+      );
       this.dialog = opts.dialog;
       this.tabIndex = opts.tabIndex;
 
@@ -1886,7 +1923,7 @@
         _.each(deps, function(d) {
           var attrArr = d.split('.'),
             name = attrArr.shift();
-          self.listenTo(self.model, "change:" + name, self.render);
+          self.listenTo(self.model, 'change:' + name, self.render);
         });
       }
     },
@@ -1894,14 +1931,14 @@
     orig_render: Backform.Fieldset.prototype.render,
     render: function() {
       var field = _.defaults(this.field.toJSON(), this.defaults),
-          evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-          };
+        evalF = function(f, d, m) {
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        };
 
       if (!field.version_compatible ||
-          !evalF(field.visible, field, this.model)) {
+        !evalF(field.visible, field, this.model)) {
         this.cleanup();
-        this.$el.empty()
+        this.$el.empty();
       } else {
         this.orig_render.apply(this, arguments);
       }
@@ -1924,36 +1961,32 @@
     fieldsetClass: 'inline-fieldset',
     legendClass: '',
     contentClass: '',
-    collapse: false
+    collapse: false,
   });
 
-
   // Backform Tab Control (in bootstrap tabbular)
   // A collection of field models.
-  var TabControl = Backform.TabControl = Backform.FieldsetControl.extend({
-    tagName: "div",
+  Backform.TabControl = Backform.FieldsetControl.extend({
+    tagName: 'div',
     className: 'inline-tab-panel',
     tabPanelClassName: 'inline-tab-panel',
     initialize: function(opts) {
       Backform.FieldsetControl.prototype.initialize.apply(
         this, arguments
-        );
+      );
       this.tabIndex = (opts.tabIndex || parseInt(Math.random() * 1000)) + 1;
     },
     // Render using Backform.Dialog (tabular UI) (only if this control is
     // visible).
     orig_render: Backform.Dialog.prototype.render,
-    template: Backform.Dialog.prototype.template
+    template: Backform.Dialog.prototype.template,
   });
 
-
   // Backform Tab Control (in bootstrap tabbular)
   // A collection of field models.
-  var PlainFieldsetControl = Backform.PlainFieldsetControl = Backform.FieldsetControl.extend({
-    initialize: function(opts) {
-      Backform.FieldsetControl.prototype.initialize.apply(
-        this, arguments
-        );
+  Backform.PlainFieldsetControl = Backform.FieldsetControl.extend({
+    initialize: function() {
+      Backform.FieldsetControl.prototype.initialize.apply(this, arguments);
     },
     template: {
       'header': _.template([
@@ -1961,11 +1994,12 @@
         ' <% if (legend != false) { %>',
         '  <legend class="<%=legendClass%>" <%=collapse ? "data-toggle=\'collapse\'" : ""%> data-target="#<%=cId%>"><%=collapse ? "<span class=\'caret\'></span>" : "" %></legend>',
         ' <% } %>',
-        '</fieldset>'
-      ].join("\n")),
+        '</fieldset>',
+      ].join('\n')),
       'content': _.template(
         '  <div id="<%= cId %>" class="<%=contentClass%>"></div>'
-    )},
+      ),
+    },
     fieldsetClass: 'inline-fieldset-without-border',
     legend: false,
   });
@@ -1973,14 +2007,14 @@
   /*
    * Control For Code Mirror SQL text area.
    */
-  var SqlFieldControl = Backform.SqlFieldControl = Backform.TextareaControl.extend({
+  Backform.SqlFieldControl = Backform.TextareaControl.extend({
 
     defaults: {
-      label: "",
+      label: '',
       extraClasses: [], // Add default control height
       helpMessage: null,
       maxlength: 4096,
-      rows: undefined
+      rows: undefined,
     },
 
     // Customize template to add new styles
@@ -1995,13 +2029,13 @@
       '  <% if (helpMessage && helpMessage.length) { %>',
       '    <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
       '  <% } %>',
-      '</div>'
-    ].join("\n")),
+      '</div>',
+    ].join('\n')),
 
     /*
      * Initialize the SQL Field control properly
      */
-    initialize: function(o) {
+    initialize: function() {
       Backform.TextareaControl.prototype.initialize.apply(this, arguments);
       this.sqlCtrl = null;
 
@@ -2029,42 +2063,42 @@
       Backform.TextareaControl.prototype.render.apply(this, arguments);
 
       var field = _.defaults(this.field.toJSON(), this.defaults),
-          attributes = this.model.toJSON(),
-          attrArr = field.name.split('.'),
-          name = attrArr.shift(),
-          path = attrArr.join('.'),
-          rawValue = this.keyPathAccessor(attributes[name], path),
-          data = _.extend(field, {
-            rawValue: rawValue,
-            value: this.formatter.fromRaw(rawValue, this.model),
-            attributes: attributes,
-            formatter: this.formatter
-          }),
-          evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-          };
+        attributes = this.model.toJSON(),
+        attrArr = field.name.split('.'),
+        name = attrArr.shift(),
+        path = attrArr.join('.'),
+        rawValue = this.keyPathAccessor(attributes[name], path),
+        data = _.extend(field, {
+          rawValue: rawValue,
+          value: this.formatter.fromRaw(rawValue, this.model),
+          attributes: attributes,
+          formatter: this.formatter,
+        }),
+        evalF = function(f, d, m) {
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        };
 
       // Evaluate the disabled, visible option
       var isDisabled = evalF(data.disabled, data, this.model),
-          isVisible = evalF(data.visible, data, this.model),
-          self = this;
+        isVisible = evalF(data.visible, data, this.model),
+        self = this;
 
       self.sqlCtrl = CodeMirror.fromTextArea(
-            (self.$el.find("textarea")[0]), {
-            lineNumbers: true,
-            mode: "text/x-pgsql",
-            extraKeys: pgAdmin.Browser.editor_shortcut_keys,
-            indentWithTabs: pgAdmin.Browser.editor_options.indent_with_tabs,
-            indentUnit: pgAdmin.Browser.editor_options.tabSize,
-            tabSize: pgAdmin.Browser.editor_options.tabSize,
-            lineWrapping: pgAdmin.Browser.editor_options.wrapCode,
-            autoCloseBrackets: pgAdmin.Browser.editor_options.insert_pair_brackets,
-            matchBrackets: pgAdmin.Browser.editor_options.brace_matching
-          });
+        (self.$el.find('textarea')[0]), {
+          lineNumbers: true,
+          mode: 'text/x-pgsql',
+          extraKeys: pgAdmin.Browser.editor_shortcut_keys,
+          indentWithTabs: pgAdmin.Browser.editor_options.indent_with_tabs,
+          indentUnit: pgAdmin.Browser.editor_options.tabSize,
+          tabSize: pgAdmin.Browser.editor_options.tabSize,
+          lineWrapping: pgAdmin.Browser.editor_options.wrapCode,
+          autoCloseBrackets: pgAdmin.Browser.editor_options.insert_pair_brackets,
+          matchBrackets: pgAdmin.Browser.editor_options.brace_matching,
+        });
 
       // Disable editor
       if (isDisabled) {
-        self.sqlCtrl.setOption("readOnly", "nocursor");
+        self.sqlCtrl.setOption('readOnly', 'nocursor');
         var cm = self.sqlCtrl.getWrapperElement();
         if (cm) {
           cm.className += ' cm_disabled';
@@ -2085,7 +2119,6 @@
       this.sqlCtrl.on('focus', this.onFocus);
       this.sqlCtrl.on('blur', this.onBlur);
 
-      var self = this;
       // Refresh SQL Field to refresh the control lazily after it renders
       setTimeout(function() {
         self.refreshTextArea.apply(self);
@@ -2120,39 +2153,39 @@
         this.$el.empty();
       }
 
-      this.model.off("pg-property-tab-changed", this.refreshTextArea, this);
+      this.model.off('pg-property-tab-changed', this.refreshTextArea, this);
 
       Backform.TextareaControl.prototype.remove.apply(this, arguments);
-    }
+    },
   });
 
   // We will use this control just as a annotate in Backform
-  var NoteControl = Backform.NoteControl = Backform.Control.extend({
+  Backform.NoteControl = Backform.Control.extend({
     defaults: {
-      label: gettext("Note"),
+      label: gettext('Note'),
       text: '',
       extraClasses: [],
-      noteClass: 'backform_control_notes'
+      noteClass: 'backform_control_notes',
     },
     template: _.template([
       '<div class="<%=noteClass%> pg-el-xs-12 <%=extraClasses.join(\' \')%>">',
       '<label class="control-label"><%=label%>:</label>',
-      '<span><%=text%></span></div>'
-    ].join("\n"))
+      '<span><%=text%></span></div>',
+    ].join('\n')),
   });
 
   /*
-  * Input File Control: This control is used with Storage Manager Dialog,
-  * It allows user to perform following operations:
-  * - Select File
-  * - Select Folder
-  * - Create File
-  * - Opening Storage Manager Dialog itself.
-  */
-  var FileControl = Backform.FileControl = Backform.InputControl.extend({
+   * Input File Control: This control is used with Storage Manager Dialog,
+   * It allows user to perform following operations:
+   * - Select File
+   * - Select Folder
+   * - Create File
+   * - Opening Storage Manager Dialog itself.
+   */
+  Backform.FileControl = Backform.InputControl.extend({
     defaults: {
-      type: "text",
-      label: "",
+      type: 'text',
+      label: '',
       min: undefined,
       max: undefined,
       maxlength: 255,
@@ -2160,40 +2193,40 @@
       dialog_title: '',
       btn_primary: '',
       helpMessage: null,
-      dialog_type: 'select_file'
+      dialog_type: 'select_file',
     },
-    initialize: function(){
+    initialize: function() {
       Backform.InputControl.prototype.initialize.apply(this, arguments);
     },
     template: _.template([
       '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
       '<div class="<%=Backform.controlsClassName%>">',
-        '<div class="file_selection_ctrl form-control">',
-          '<input type="<%=type%>" class="browse_file_input form-control <%=extraClasses.join(\' \')%>" name="<%=name%>" min="<%=min%>" max="<%=max%>"maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
-          '<button class="btn fa fa-ellipsis-h select_item pull-right" <%=disabled ? "disabled" : ""%> ></button>',
-          '<% if (helpMessage && helpMessage.length) { %>',
-          '<span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
-          '<% } %>',
-        '</div>',
-      '</div>'
-    ].join("\n")),
+      '<div class="file_selection_ctrl form-control">',
+      '<input type="<%=type%>" class="browse_file_input form-control <%=extraClasses.join(\' \')%>" name="<%=name%>" min="<%=min%>" max="<%=max%>"maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
+      '<button class="btn fa fa-ellipsis-h select_item pull-right" <%=disabled ? "disabled" : ""%> ></button>',
+      '<% if (helpMessage && helpMessage.length) { %>',
+      '<span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
+      '<% } %>',
+      '</div>',
+      '</div>',
+    ].join('\n')),
     events: function() {
       // Inherit all default events of InputControl
       return _.extend({}, Backform.InputControl.prototype.events, {
-        "click .select_item": "onSelect"
+        'click .select_item': 'onSelect',
       });
     },
-    onSelect: function(ev) {
+    onSelect: function() {
       var dialog_type = this.field.get('dialog_type'),
-          supp_types = this.field.get('supp_types'),
-          btn_primary = this.field.get('btn_primary'),
-          dialog_title = this.field.get('dialog_title'),
-          params = {
-            supported_types: supp_types,
-            dialog_type: dialog_type,
-            dialog_title: dialog_title,
-            btn_primary: btn_primary
-          };
+        supp_types = this.field.get('supp_types'),
+        btn_primary = this.field.get('btn_primary'),
+        dialog_title = this.field.get('dialog_title'),
+        params = {
+          supported_types: supp_types,
+          dialog_type: dialog_type,
+          dialog_title: dialog_title,
+          btn_primary: btn_primary,
+        };
 
       pgAdmin.FileManager.init();
       pgAdmin.FileManager.show_dialog(params);
@@ -2201,9 +2234,8 @@
       this.listen_file_dlg_events();
     },
     storage_dlg_hander: function(value) {
-      var field = _.defaults(this.field.toJSON(), this.defaults),
-          attrArr = this.field.get("name").split('.'),
-          name = attrArr.shift();
+      var attrArr = this.field.get('name').split('.'),
+        name = attrArr.shift();
 
       this.remove_file_dlg_event_listeners();
 
@@ -2214,73 +2246,73 @@
       this.remove_file_dlg_event_listeners();
     },
     listen_file_dlg_events: function() {
-      pgAdmin.Browser.Events.on('pgadmin-storage:finish_btn:'+this.field.get('dialog_type'), this.storage_dlg_hander, this);
-      pgAdmin.Browser.Events.on('pgadmin-storage:cancel_btn:'+this.field.get('dialog_type'), this.storage_close_dlg_hander, this);
+      pgAdmin.Browser.Events.on('pgadmin-storage:finish_btn:' + this.field.get('dialog_type'), this.storage_dlg_hander, this);
+      pgAdmin.Browser.Events.on('pgadmin-storage:cancel_btn:' + this.field.get('dialog_type'), this.storage_close_dlg_hander, this);
     },
     remove_file_dlg_event_listeners: function() {
-      pgAdmin.Browser.Events.off('pgadmin-storage:finish_btn:'+this.field.get('dialog_type'), this.storage_dlg_hander, this);
-      pgAdmin.Browser.Events.off('pgadmin-storage:cancel_btn:'+this.field.get('dialog_type'), this.storage_close_dlg_hander, this);
+      pgAdmin.Browser.Events.off('pgadmin-storage:finish_btn:' + this.field.get('dialog_type'), this.storage_dlg_hander, this);
+      pgAdmin.Browser.Events.off('pgadmin-storage:cancel_btn:' + this.field.get('dialog_type'), this.storage_close_dlg_hander, this);
     },
     clearInvalid: function() {
       Backform.InputControl.prototype.clearInvalid.apply(this, arguments);
-      this.$el.removeClass("pgadmin-file-has-error");
+      this.$el.removeClass('pgadmin-file-has-error');
       return this;
     },
     updateInvalid: function() {
       Backform.InputControl.prototype.updateInvalid.apply(this, arguments);
       // Introduce a new class to fix the error icon placement on the control
-      this.$el.addClass("pgadmin-file-has-error");
-    }
+      this.$el.addClass('pgadmin-file-has-error');
+    },
   });
 
-  var DatetimepickerControl = Backform.DatetimepickerControl =
-      Backform.InputControl.extend({
-    defaults: {
-      type: "text",
-      label: "",
-      options: {
-        format: "YYYY-MM-DD HH:mm:ss Z",
-        showClear: true,
-        showTodayButton: true,
-        toolbarPlacement: 'top',
-        widgetPositioning: {
-          horizontal: 'auto',
-          vertical: 'bottom'
+  Backform.DatetimepickerControl =
+    Backform.InputControl.extend({
+      defaults: {
+        type: 'text',
+        label: '',
+        options: {
+          format: 'YYYY-MM-DD HH:mm:ss Z',
+          showClear: true,
+          showTodayButton: true,
+          toolbarPlacement: 'top',
+          widgetPositioning: {
+            horizontal: 'auto',
+            vertical: 'bottom',
+          },
         },
+        placeholder: 'YYYY-MM-DD HH:mm:ss Z',
+        extraClasses: [],
+        helpMessage: null,
       },
-      placeholder: "YYYY-MM-DD HH:mm:ss Z",
-      extraClasses: [],
-      helpMessage: null
-    },
-    events: {
-      "blur input": "onChange",
-      "change input": "onChange",
-      "changeDate input": "onChange",
-      "focus input": "clearInvalid",
-      'db.change': "onChange",
-      'click': 'openPicker'
-    },
-    openPicker: function() {
-      if (this.has_datepicker) {
-        this.$el.find("input").datetimepicker('show');
-      }
-    },
-    template: _.template([
-      '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
-      '<div class="input-group  <%=Backform.controlsClassName%>">',
-      ' <input type="text" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
-      ' <span class="input-group-addon">',
-      '  <span class="fa fa-calendar"></span>',
-      ' </span>',
-      '</div>',
-      '<% if (helpMessage && helpMessage.length) { %>',
-      ' <div class="<%=Backform.controlsClassName%>">',
-      '   <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
-      ' </div>',
-      '<% } %>'
-    ].join("\n")),
-    render: function() {
-      var field = _.defaults(this.field.toJSON(), this.defaults),
+      events: {
+        'blur input': 'onChange',
+        'change input': 'onChange',
+        'changeDate input': 'onChange',
+        'focus input': 'clearInvalid',
+        'db.change': 'onChange',
+        'click': 'openPicker',
+      },
+      openPicker: function() {
+        if (this.has_datepicker) {
+          this.$el.find('input').datetimepicker('show');
+        }
+      },
+      template: _.template([
+        '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
+        '<div class="input-group  <%=Backform.controlsClassName%>">',
+        ' <input type="text" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
+        ' <span class="input-group-addon">',
+        '  <span class="fa fa-calendar"></span>',
+        ' </span>',
+        '</div>',
+        '<% if (helpMessage && helpMessage.length) { %>',
+        ' <div class="<%=Backform.controlsClassName%>">',
+        '   <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
+        ' </div>',
+        '<% } %>',
+      ].join('\n')),
+      render: function() {
+        var field = _.defaults(this.field.toJSON(), this.defaults),
           attributes = this.model.toJSON(),
           attrArr = field.name.split('.'),
           name = attrArr.shift(),
@@ -2290,106 +2322,110 @@
             rawValue: rawValue,
             value: this.formatter.fromRaw(rawValue, this.model),
             attributes: attributes,
-            formatter: this.formatter
+            formatter: this.formatter,
           }),
           evalF = function(f, m) {
             return (_.isFunction(f) ? !!f(m) : !!f);
           };
 
-      // Evaluate the disabled, visible, and required option
-      _.extend(data, {
-        disabled: evalF(data.disabled, this.model),
-        visible:  evalF(data.visible, this.model),
-        required: evalF(data.required, this.model)
-      });
-      if (!data.disabled) {
-        data.placeholder = data.placeholder || this.defaults.placeholder;
-      }
+        // Evaluate the disabled, visible, and required option
+        _.extend(data, {
+          disabled: evalF(data.disabled, this.model),
+          visible: evalF(data.visible, this.model),
+          required: evalF(data.required, this.model),
+        });
+        if (!data.disabled) {
+          data.placeholder = data.placeholder || this.defaults.placeholder;
+        }
 
-      // Clean up first
-      if (this.has_datepicker)
-        this.$el.find("input").datetimepicker('destroy');
-      this.$el.empty();
-      this.$el.removeClass(Backform.hiddenClassName);
+        // Clean up first
+        if (this.has_datepicker)
+          this.$el.find('input').datetimepicker('destroy');
+        this.$el.empty();
+        this.$el.removeClass(Backform.hiddenClassName);
 
 
-      this.$el.html(this.template(data)).addClass(field.name);
+        this.$el.html(this.template(data)).addClass(field.name);
 
-      if (!data.visible) {
-        this.has_datepicker = false;
-        this.$el.addClass(Backform.hiddenClassName);
-      } else {
-        this.has_datepicker = true;
-        var self = this;
-        this.$el.find("input").first().datetimepicker(
-          _.extend({
-            keyBinds: {
-              enter: function(widget) {
-                var picker = this;
-                if (widget) {
-                  setTimeout(function() {
-                    picker.toggle();
-                    self.$el.find('input').first().blur();
-                  }, 10);
-                } else {
-                  setTimeout(function() { picker.toggle(); }, 10);
-                }
-              },
-              tab: function(widget) {
-                if (!widget) {
-                  // blur the input
-                  setTimeout(
-                    function() { self.$el.find('input').first().blur(); }, 10
-                  );
-                }
-              },
-              escape: function(widget) {
-                if (widget) {
+        if (!data.visible) {
+          this.has_datepicker = false;
+          this.$el.addClass(Backform.hiddenClassName);
+        } else {
+          this.has_datepicker = true;
+          var self = this;
+          this.$el.find('input').first().datetimepicker(
+            _.extend({
+              keyBinds: {
+                enter: function(widget) {
                   var picker = this;
-                  setTimeout(function() {
-                    picker.toggle();
-                    self.$el.find('input').first().blur();
-                  }, 10);
-                }
-              }
-            }
-          }, this.defaults.options, this.field.get("options"),
-          {'date': data.value})
-        );
-      }
-      this.updateInvalid();
-
-      return this;
-    },
-    clearInvalid: function() {
-      Backform.InputControl.prototype.clearInvalid.apply(this, arguments);
-      this.$el.removeClass("pgadmin-datepicker-has-error");
-      return this;
-    },
-    updateInvalid: function() {
-      Backform.InputControl.prototype.updateInvalid.apply(this, arguments);
-      // Introduce a new class to fix the error icon placement on the control
-      this.$el.addClass("pgadmin-datepicker-has-error");
-    },
-    cleanup: function() {
-      if (this.has_datepicker)
-        this.$el.find("input").datetimepicker('destroy');
-      this.$el.empty();
-    }
-  });
+                  if (widget) {
+                    setTimeout(function() {
+                      picker.toggle();
+                      self.$el.find('input').first().blur();
+                    }, 10);
+                  } else {
+                    setTimeout(function() {
+                      picker.toggle();
+                    }, 10);
+                  }
+                },
+                tab: function(widget) {
+                  if (!widget) {
+                    // blur the input
+                    setTimeout(
+                      function() {
+                        self.$el.find('input').first().blur();
+                      }, 10
+                    );
+                  }
+                },
+                escape: function(widget) {
+                  if (widget) {
+                    var picker = this;
+                    setTimeout(function() {
+                      picker.toggle();
+                      self.$el.find('input').first().blur();
+                    }, 10);
+                  }
+                },
+              },
+            }, this.defaults.options, this.field.get('options'), {
+              'date': data.value,
+            })
+          );
+        }
+        this.updateInvalid();
 
+        return this;
+      },
+      clearInvalid: function() {
+        Backform.InputControl.prototype.clearInvalid.apply(this, arguments);
+        this.$el.removeClass('pgadmin-datepicker-has-error');
+        return this;
+      },
+      updateInvalid: function() {
+        Backform.InputControl.prototype.updateInvalid.apply(this, arguments);
+        // Introduce a new class to fix the error icon placement on the control
+        this.$el.addClass('pgadmin-datepicker-has-error');
+      },
+      cleanup: function() {
+        if (this.has_datepicker)
+          this.$el.find('input').datetimepicker('destroy');
+        this.$el.empty();
+      },
+    });
 
   // Color Picker control
-  var ColorControl = Backform.ColorControl = Backform.InputControl.extend({
+  Backform.ColorControl = Backform.InputControl.extend({
     defaults: {
-      label: "",
+      label: '',
       extraClasses: [],
       helpMessage: null,
       showButtons: false,
       showPalette: true,
       allowEmpty: true,
-      colorFormat: "hex",
-      defaultColor: ""
+      colorFormat: 'hex',
+      defaultColor: '',
     },
     template: _.template([
       '<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
@@ -2398,35 +2434,35 @@
       '  <% if (helpMessage && helpMessage.length) { %>',
       '    <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
       '  <% } %>',
-      '</div>'
-    ].join("\n")),
+      '</div>',
+    ].join('\n')),
     render: function() {
       // Clear first
-      if(this.$picker && this.$picker.hasOwnProperty('destroy')) {
+      if (this.$picker && this.$picker.hasOwnProperty('destroy')) {
         this.$picker('destroy');
       }
 
       var field = _.defaults(this.field.toJSON(), this.defaults),
-          attributes = this.model.toJSON(),
-          attrArr = field.name.split('.'),
-          name = attrArr.shift(),
-          path = attrArr.join('.'),
-          rawValue = this.keyPathAccessor(attributes[name], path),
-          data = _.extend(field, {
-            rawValue: rawValue,
-            value: this.formatter.fromRaw(rawValue, this.model),
-            attributes: attributes,
-            formatter: this.formatter
-          }),
-          evalF = function(f, d, m) {
-            return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
-          };
+        attributes = this.model.toJSON(),
+        attrArr = field.name.split('.'),
+        name = attrArr.shift(),
+        path = attrArr.join('.'),
+        rawValue = this.keyPathAccessor(attributes[name], path),
+        data = _.extend(field, {
+          rawValue: rawValue,
+          value: this.formatter.fromRaw(rawValue, this.model),
+          attributes: attributes,
+          formatter: this.formatter,
+        }),
+        evalF = function(f, d, m) {
+          return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f);
+        };
 
       // Evaluate the disabled, visible, and required option
       _.extend(data, {
         disabled: evalF(data.disabled, data, this.model),
-        visible:  evalF(data.visible, data, this.model),
-        required: evalF(data.required, data, this.model)
+        visible: evalF(data.visible, data, this.model),
+        required: evalF(data.required, data, this.model),
       });
 
       // Clean up first
@@ -2438,11 +2474,11 @@
       this.$el.html(this.template(data)).addClass(field.name);
 
       // Creating default Color picker
-      this.$picker = this.$el.find("input").spectrum({
+      this.$picker = this.$el.find('input').spectrum({
         allowEmpty: data.allowEmpty,
         preferredFormat: data.colorFormat,
         disabled: data.disabled,
-        hideAfterPaletteSelect:true,
+        hideAfterPaletteSelect: true,
         clickoutFiresChange: true,
         showButtons: data.showButtons,
         showPaletteOnly: data.showPalette,
@@ -2452,21 +2488,21 @@
         color: data.value || data.defaultColor,
         // Predefined palette colors
         palette: [
-            ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
-            ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
-            ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
-            ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
-            ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
-            ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
-            ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
-            ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
-        ]
+          ['#000', '#444', '#666', '#999', '#ccc', '#eee', '#f3f3f3', '#fff'],
+          ['#f00', '#f90', '#ff0', '#0f0', '#0ff', '#00f', '#90f', '#f0f'],
+          ['#f4cccc', '#fce5cd', '#fff2cc', '#d9ead3', '#d0e0e3', '#cfe2f3', '#d9d2e9', '#ead1dc'],
+          ['#ea9999', '#f9cb9c', '#ffe599', '#b6d7a8', '#a2c4c9', '#9fc5e8', '#b4a7d6', '#d5a6bd'],
+          ['#e06666', '#f6b26b', '#ffd966', '#93c47d', '#76a5af', '#6fa8dc', '#8e7cc3', '#c27ba0'],
+          ['#c00', '#e69138', '#f1c232', '#6aa84f', '#45818e', '#3d85c6', '#674ea7', '#a64d79'],
+          ['#900', '#b45f06', '#bf9000', '#38761d', '#134f5c', '#0b5394', '#351c75', '#741b47'],
+          ['#600', '#783f04', '#7f6000', '#274e13', '#0c343d', '#073763', '#20124d', '#4c1130'],
+        ],
 
       });
       this.updateInvalid();
       return this;
-    }
+    },
   });
 
   return Backform;
-}));
+});
diff --git a/web/pgadmin/static/js/backgrid.pgadmin.js b/web/pgadmin/static/js/backgrid.pgadmin.js
index b4ec1981..bec22cea 100644
--- a/web/pgadmin/static/js/backgrid.pgadmin.js
+++ b/web/pgadmin/static/js/backgrid.pgadmin.js
@@ -1,52 +1,30 @@
-(function(root, factory) {
-  // Set up Backform appropriately for the environment. Start with AMD.
-  if (typeof define === 'function' && define.amd) {
-    define([
-      'sources/gettext', 'underscore', 'jquery', 'backbone', 'backform', 'backgrid', 'alertify',
-      'moment', 'bignumber', 'bootstrap.datetimepicker', 'bootstrap.switch'
-    ],
-     function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, moment, BigNumber) {
-      // Export global even in AMD case in case this script is loaded with
-      // others that may still expect a global Backform.
-      return factory(root, gettext, _, $, Backbone, Backform, Backgrid, Alertify, moment, BigNumber);
-    });
-
-  // Next for Node.js or CommonJS. jQuery may not be needed as a module.
-  } else if (typeof exports !== 'undefined') {
-    var gettext = require('sources/gettext'),
-      _ = require('underscore') || root._,
-      $ = root.jQuery || root.$ || root.Zepto || root.ender,
-      Backbone = require('backbone') || root.Backbone,
-      Backform = require('backform') || root.Backform,
-      Backgrid = require('backgrid') || root.Backgrid,
-      Alertify = require('alertify') || root.Alertify,
-      moment = require('moment') || root.moment;
-    factory(root, gettext, _, $, Backbone, Backform, Backgrid, Alertify, moment);
-
-  // Finally, as a browser global.
-  } else {
-    factory(root, root.gettext, root._, (root.jQuery || root.Zepto || root.ender || root.$), root.Backbone, root.Backform, root.Alertify, root.moment);
-  }
-} (this, function(root, gettext, _, $, Backbone, Backform, Backgrid, Alertify, moment, BigNumber) {
+define([
+  'sources/gettext', 'underscore', 'jquery', 'backbone', 'backform', 'backgrid', 'alertify',
+  'moment', 'bignumber', 'bootstrap.datetimepicker', 'bootstrap.switch',
+], function(
+  gettext, _, $, Backbone, Backform, Backgrid, Alertify, moment, BigNumber
+) {
   /*
-     * Add mechanism in backgrid to render different types of cells in
-     * same column;
+   * Add mechanism in backgrid to render different types of cells in
+   * same column;
    */
 
   // Add new property cellFunction in Backgrid.Column.
-  _.extend(Backgrid.Column.prototype.defaults, {cellFunction: undefined});
+  _.extend(Backgrid.Column.prototype.defaults, {
+    cellFunction: undefined,
+  });
 
   // Add tooltip to cell if cell content is larger than
   // cell width
   _.extend(Backgrid.Cell.prototype.events, {
-    'mouseover': function(e) {
+    'mouseover': function() {
       var $el = $(this.el);
-      if($el.text().length > 0 && !$el.attr('title') &&
+      if ($el.text().length > 0 && !$el.attr('title') &&
         ($el.innerWidth() + 1) < $el[0].scrollWidth
       ) {
         $el.attr('title', $.trim($el.text()));
       }
-    }
+    },
   });
 
   /* Overriding backgrid sort method.
@@ -59,35 +37,38 @@
    */
 
   _.extend(Backgrid.Body.prototype, {
-    sort: function (column, direction) {
+    sort: function(column, direction) {
 
-      if (!_.contains(["ascending", "descending", null], direction)) {
+      if (!_.contains(['ascending', 'descending', null], direction)) {
         throw new RangeError('direction must be one of "ascending", "descending" or `null`');
       }
 
-      if (_.isString(column)) column = this.columns.findWhere({name: column});
+      if (_.isString(column)) column = this.columns.findWhere({
+        name: column,
+      });
 
       var collection = this.collection;
 
       var order;
-      if (direction === "ascending") order = -1;
-      else if (direction === "descending") order = 1;
+      if (direction === 'ascending') order = -1;
+      else if (direction === 'descending') order = 1;
       else order = null;
 
       // Get column type and pass it to comparator.
       var col_type = column.get('cell').prototype.className || 'string-cell',
-          comparator = this.makeComparator(column.get("name"), order,
-                                          order ?
-                                          column.sortValue() :
-                                          function (model) {
-                                            return model.cid.replace('c', '') * 1;
-                                          }, col_type);
+        comparator = this.makeComparator(column.get('name'), order,
+          order ?
+          column.sortValue() :
+          function(model) {
+            return model.cid.replace('c', '') * 1;
+          }, col_type);
 
       if (Backbone.PageableCollection &&
-          collection instanceof Backbone.PageableCollection) {
+        collection instanceof Backbone.PageableCollection) {
 
-        collection.setSorting(order && column.get("name"), order,
-                              {sortValue: column.sortValue()});
+        collection.setSorting(order && column.get('name'), order, {
+          sortValue: column.sortValue(),
+        });
 
         if (collection.fullCollection) {
           // If order is null, pageable will remove the comparator on both sides,
@@ -97,28 +78,31 @@
             collection.fullCollection.comparator = comparator;
           }
           collection.fullCollection.sort();
-          collection.trigger("backgrid:sorted", column, direction, collection);
-        }
-        else collection.fetch({reset: true, success: function () {
-          collection.trigger("backgrid:sorted", column, direction, collection);
-        }});
-      }
-      else {
+          collection.trigger('backgrid:sorted', column, direction, collection);
+        } else collection.fetch({
+          reset: true,
+          success: function() {
+            collection.trigger('backgrid:sorted', column, direction, collection);
+          },
+        });
+      } else {
         collection.comparator = comparator;
         collection.sort();
-        collection.trigger("backgrid:sorted", column, direction, collection);
+        collection.trigger('backgrid:sorted', column, direction, collection);
       }
 
-      column.set("direction", direction);
+      column.set('direction', direction);
 
       return this;
     },
-    makeComparator: function (attr, order, func, type) {
+    makeComparator: function(attr, order, func, type) {
 
-      return function (left, right) {
+      return function(left, right) {
         // extract the values from the models
 
-        var l = func(left, attr), r = func(right, attr), t;
+        var l = func(left, attr),
+          r = func(right, attr),
+          t;
         if (_.isUndefined(l) || _.isUndefined(r)) return;
 
         var types = ['number-cell', 'integer-cell'];
@@ -127,44 +111,43 @@
           // NaN if invalid number
           try {
             _l = new BigNumber(l);
-          } catch(err) {
+          } catch (err) {
             _l = NaN;
           }
 
           try {
             _r = new BigNumber(r);
-          } catch(err) {
+          } catch (err) {
             _r = NaN;
           }
 
           // if descending order, swap left and right
           if (order === 1) t = _l, _l = _r, _r = t;
 
-          if (_l.eq(_r))  // If both are equals
+          if (_l.eq(_r)) // If both are equals
             return 0;
           else if (_l.lt(_r)) // If left is less than right
             return -1;
           else
             return 1;
-        }
-        else {
+        } else {
           // if descending order, swap left and right
           if (order === 1) t = l, l = r, r = t;
 
-           // compare as usual
+          // compare as usual
           if (l === r) return 0;
           else if (l < r) return -1;
           return 1;
         }
       };
-    }
+    },
   });
 
   _.extend(Backgrid.Row.prototype, {
-    makeCell: function (column) {
-      return new (this.getCell(column))({
+    makeCell: function(column) {
+      return new(this.getCell(column))({
         column: column,
-        model: this.model
+        model: this.model,
       });
     },
     /*
@@ -174,57 +157,56 @@
      * cellFunction will be called with context (this) as column and model as
      * argument.
      */
-    getCell: function (column) {
-      var cf = column.get("cellFunction");
-      if (_.isFunction(cf)){
+    getCell: function(column) {
+      var cf = column.get('cellFunction');
+      if (_.isFunction(cf)) {
         var cell = cf.apply(column, [this.model]);
         try {
-          return Backgrid.resolveNameToClass(cell, "Cell");
+          return Backgrid.resolveNameToClass(cell, 'Cell');
         } catch (e) {
           if (e instanceof ReferenceError) {
             // Fallback to column cell.
-            return column.get("cell");
+            return column.get('cell');
           } else {
             throw e; // Let other exceptions bubble up
           }
         }
       } else {
-        return column.get("cell");
+        return column.get('cell');
       }
-    }
+    },
   });
 
   var ObjectCellEditor = Backgrid.Extension.ObjectCellEditor = Backgrid.CellEditor.extend({
     modalTemplate: _.template([
       '<div class="subnode-dialog" tabindex="1">',
       '    <div class="subnode-body"></div>',
-      '</div>'
-    ].join("\n")),
+      '</div>',
+    ].join('\n')),
     stringTemplate: _.template([
       '<div class="form-group">',
       '  <label class="control-label col-sm-4"><%=label%></label>',
       '  <div class="col-sm-8">',
       '    <input type="text" class="form-control" name="<%=name%>" value="<%=value%>" placeholder="<%=placeholder%>" />',
       '  </div>',
-      '</div>'
-    ].join("\n")),
+      '</div>',
+    ].join('\n')),
     extendWithOptions: function(options) {
       _.extend(this, options);
     },
-    render: function () {
+    render: function() {
       return this;
     },
     postRender: function(model, column) {
-      var editor = this,
-          el = this.el,
-          columns_length = this.columns_length,
-          // To render schema directly from Backgrid cell we use columns schema attribute
-          schema = this.schema.length ? this.schema : this.column.get('schema');
+      var columns_length = this.columns_length,
+        // To render schema directly from Backgrid cell we use columns schema
+        // attribute.
+        schema = this.schema.length ? this.schema : this.column.get('schema');
 
-      if (column != null && column.get("name") != this.column.get("name"))
+      if (column != null && column.get('name') != this.column.get('name'))
         return false;
 
-      if (!_.isArray(schema)) throw new TypeError("schema must be an array");
+      if (!_.isArray(schema)) throw new TypeError('schema must be an array');
 
       // Create a Backbone model from our object if it does not exist
       var $dialog = this.createDialog(columns_length);
@@ -237,10 +219,12 @@
       var back_el = $dialog.find('form.form-dialog');
 
       this.objectView = new Backform.Dialog({
-        el: back_el, model: this.model, schema: schema,
+        el: back_el,
+        model: this.model,
+        schema: schema,
         tabPanelClassName: function() {
           return 'sub-node-form col-sm-12';
-        }
+        },
       });
 
       this.objectView.render();
@@ -248,10 +232,16 @@
       return this;
     },
     createDialog: function(noofcol) {
-      var $dialog = this.$dialog = $(this.modalTemplate({title: ""})),
-          tr = $("<tr>"),
-          noofcol = noofcol || 1,
-          td = $("<td>", {class: 'editable sortable renderable', style: 'height: auto', colspan: noofcol+2}).appendTo(tr);
+      noofcol = noofcol || 1;
+      var $dialog = this.$dialog = $(this.modalTemplate({
+          title: '',
+        })),
+        tr = $('<tr>'),
+        td = $('<td>', {
+          class: 'editable sortable renderable',
+          style: 'height: auto',
+          colspan: noofcol + 2,
+        }).appendTo(tr);
 
       this.tr = tr;
 
@@ -263,7 +253,9 @@
     },
     save: function() {
       // Retrieve values from the form, and store inside the object model
-      this.model.trigger("backgrid:edited", this.model, this.column, new Backgrid.Command({keyCode:13}));
+      this.model.trigger('backgrid:edited', this.model, this.column, new Backgrid.Command({
+        keyCode: 13,
+      }));
       if (this.tr) {
         this.tr.remove();
       }
@@ -277,34 +269,34 @@
         this.tr.remove();
       }
       return this;
-    }
+    },
   });
 
-  var PGSelectCell = Backgrid.Extension.PGSelectCell = Backgrid.SelectCell.extend({
+  Backgrid.Extension.PGSelectCell = Backgrid.SelectCell.extend({
     // It's possible to render an option group or use a
     // function to provide option values too.
     optionValues: function() {
       var res = [],
-          opts = _.result(this.column.attributes, 'options');
+        opts = _.result(this.column.attributes, 'options');
       _.each(opts, function(o) {
         res.push([o.label, o.value]);
       });
       return res;
-    }
+    },
   });
 
-  var ObjectCell = Backgrid.Extension.ObjectCell = Backgrid.Cell.extend({
+  Backgrid.Extension.ObjectCell = Backgrid.Cell.extend({
     editorOptionDefaults: {
-      schema: []
+      schema: [],
     },
-    className: "edit-cell",
+    className: 'edit-cell',
     editor: ObjectCellEditor,
     initialize: function(options) {
       Backgrid.Cell.prototype.initialize.apply(this, arguments);
 
       // Pass on cell options to the editor
       var cell = this,
-          editorOptions = {};
+        editorOptions = {};
       _.each(this.editorOptionDefaults, function(def, opt) {
         if (!cell[opt]) cell[opt] = def;
         if (options && options[opt]) cell[opt] = options[opt];
@@ -313,23 +305,23 @@
 
       editorOptions['el'] = $(this.el);
       editorOptions['columns_length'] = this.column.collection.length;
-      editorOptions['el'].attr('tabindex' , 1);
+      editorOptions['el'].attr('tabindex', 1);
 
-      this.listenTo(this.model, "backgrid:edit", function (model, column, cell, editor) {
-        if (column.get("name") == this.column.get("name"))
+      this.listenTo(this.model, 'backgrid:edit', function(model, column, cell, editor) {
+        if (column.get('name') == this.column.get('name'))
           editor.extendWithOptions(editorOptions);
       });
     },
-    enterEditMode: function () {
+    enterEditMode: function() {
       // Notify that we are about to enter in edit mode for current cell.
-     // We will check if this row is editable first
+      // We will check if this row is editable first
       var canEditRow = (!_.isUndefined(this.column.get('canEditRow')) &&
-                          _.isFunction(this.column.get('canEditRow'))) ?
-                          Backgrid.callByNeed(this.column.get('canEditRow'),
-                          this.column, this.model) : true;
+          _.isFunction(this.column.get('canEditRow'))) ?
+        Backgrid.callByNeed(this.column.get('canEditRow'),
+          this.column, this.model) : true;
       if (canEditRow) {
         // Notify that we are about to enter in edit mode for current cell.
-        this.model.trigger("enteringEditMode", [this]);
+        this.model.trigger('enteringEditMode', [this]);
 
         Backgrid.Cell.prototype.enterEditMode.apply(this, arguments);
         /* Make sure - we listen to the click event */
@@ -338,26 +330,26 @@
 
         if (editable) {
           this.$el.html(
-            "<i class='fa fa-pencil-square subnode-edit-in-process'></i>"
-            );
+            '<i class=\'fa fa-pencil-square subnode-edit-in-process\'></i>'
+          );
           this.model.trigger(
-            "pg-sub-node:opened", this.model, this
-            );
+            'pg-sub-node:opened', this.model, this
+          );
         }
       } else {
-          Alertify.alert(gettext("This object is not user editable."),
-            function(){
-              return true;
+        Alertify.alert(gettext('This object is not user editable.'),
+          function() {
+            return true;
           });
       }
     },
-    render: function(){
-        this.$el.empty();
-        this.$el.html("<i class='fa fa-pencil-square-o'></i>");
-        this.delegateEvents();
-        if (this.grabFocus)
-          this.$el.focus();
-        return this;
+    render: function() {
+      this.$el.empty();
+      this.$el.html('<i class=\'fa fa-pencil-square-o\'></i>');
+      this.delegateEvents();
+      if (this.grabFocus)
+        this.$el.focus();
+      return this;
     },
     exitEditMode: function() {
       var index = $(this.currentEditor.objectView.el)
@@ -365,8 +357,8 @@
         .data('tabIndex');
       Backgrid.Cell.prototype.exitEditMode.apply(this, arguments);
       this.model.trigger(
-          "pg-sub-node:closed", this, index
-          );
+        'pg-sub-node:closed', this, index
+      );
       this.grabFocus = true;
     },
     events: {
@@ -379,87 +371,89 @@
           this.enterEditMode.call(this, []);
         }
         e.preventDefault();
-      }
-    }
+      },
+    },
   });
 
-  var DeleteCell = Backgrid.Extension.DeleteCell = Backgrid.Cell.extend({
-      defaults: _.defaults({
-        defaultDeleteMsg: gettext('Are you sure you wish to delete this row?'),
-        defaultDeleteTitle: gettext('Delete Row')
-      }, Backgrid.Cell.prototype.defaults),
+  Backgrid.Extension.DeleteCell = Backgrid.Cell.extend({
+    defaults: _.defaults({
+      defaultDeleteMsg: gettext('Are you sure you wish to delete this row?'),
+      defaultDeleteTitle: gettext('Delete Row'),
+    }, Backgrid.Cell.prototype.defaults),
 
-      /** @property */
-      className: "delete-cell",
-      events: {
-        "click": "deleteRow"
-      },
-      deleteRow: function (e) {
-        e.preventDefault();
-        var that = this;
-        // We will check if row is deletable or not
-        var canDeleteRow = (!_.isUndefined(this.column.get('canDeleteRow')) &&
-                            _.isFunction(this.column.get('canDeleteRow')) ) ?
-                             Backgrid.callByNeed(this.column.get('canDeleteRow'),
-                              this.column, this.model) : true;
-        if (canDeleteRow) {
-          var delete_msg = !_.isUndefined(this.column.get('customDeleteMsg')) ?
-                           this.column.get('customDeleteMsg'): that.defaults.defaultDeleteMsg;
-          var delete_title = !_.isUndefined(this.column.get('customDeleteTitle')) ?
-                           this.column.get('customDeleteTitle'): that.defaults.defaultDeleteTitle;
-          Alertify.confirm(
-            delete_title,
-            delete_msg,
-            function(evt) {
-              that.model.collection.remove(that.model);
-            },
-            function(evt) {
-              return true;
-            }
-          );
-        } else {
-          Alertify.alert(gettext("This object cannot be deleted."),
-            function(){
-              return true;
-            }
-          );
-        }
-      },
-      initialize: function () {
-          Backgrid.Cell.prototype.initialize.apply(this, arguments);
-      },
-      render: function () {
-          this.$el.empty();
-          this.$el.html("<i class='fa fa-trash'></i>");
-          this.delegateEvents();
-          return this;
+    /** @property */
+    className: 'delete-cell',
+    events: {
+      'click': 'deleteRow',
+    },
+    deleteRow: function(e) {
+      e.preventDefault();
+      var that = this;
+      // We will check if row is deletable or not
+      var canDeleteRow = (!_.isUndefined(this.column.get('canDeleteRow')) &&
+          _.isFunction(this.column.get('canDeleteRow'))) ?
+        Backgrid.callByNeed(this.column.get('canDeleteRow'),
+          this.column, this.model) : true;
+      if (canDeleteRow) {
+        var delete_msg = !_.isUndefined(this.column.get('customDeleteMsg')) ?
+          this.column.get('customDeleteMsg') : that.defaults.defaultDeleteMsg;
+        var delete_title = !_.isUndefined(this.column.get('customDeleteTitle')) ?
+          this.column.get('customDeleteTitle') : that.defaults.defaultDeleteTitle;
+        Alertify.confirm(
+          delete_title,
+          delete_msg,
+          function() {
+            that.model.collection.remove(that.model);
+          },
+          function() {
+            return true;
+          }
+        );
+      } else {
+        Alertify.alert(gettext('This object cannot be deleted.'),
+          function() {
+            return true;
+          }
+        );
       }
+    },
+    initialize: function() {
+      Backgrid.Cell.prototype.initialize.apply(this, arguments);
+    },
+    render: function() {
+      this.$el.empty();
+      this.$el.html('<i class=\'fa fa-trash\'></i>');
+      this.delegateEvents();
+      return this;
+    },
   });
 
-  var CustomHeaderCell = Backgrid.Extension.CustomHeaderCell = Backgrid.HeaderCell.extend({
-    initialize: function () {
+  Backgrid.Extension.CustomHeaderCell = Backgrid.HeaderCell.extend({
+    initialize: function() {
       // Here, we will add custom classes to header cell
       Backgrid.HeaderCell.prototype.initialize.apply(this, arguments);
       var getClassName = this.column.get('cellHeaderClasses');
       if (getClassName) {
         this.$el.addClass(getClassName);
       }
-    }
+    },
   });
 
   /**
     SwitchCell renders a Bootstrap Switch in backgrid cell
   */
-  $.fn.bootstrapSwitch = jQuery.fn.bootstrapSwitch;
-  var SwitchCell = Backgrid.Extension.SwitchCell = Backgrid.BooleanCell.extend({
+  if (window.jQuery && window.jQuery.fn.bootstrapSwitch)
+    $.fn.bootstrapSwitch = window.jQuery.fn.bootstrapSwitch;
+
+  Backgrid.Extension.SwitchCell = Backgrid.BooleanCell.extend({
     defaults: {
       options: _.defaults({
         onText: gettext('True'),
         offText: gettext('False'),
         onColor: 'success',
         offColor: 'default',
-        size: 'mini'
-        }, $.fn.bootstrapSwitch.defaults)
+        size: 'mini',
+      }, $.fn.bootstrapSwitch.defaults),
     },
 
     className: 'switch-cell',
@@ -479,71 +473,73 @@
     },
 
     events: {
-      'switchChange.bootstrapSwitch': 'onChange'
+      'switchChange.bootstrapSwitch': 'onChange',
     },
 
-    onChange: function () {
+    onChange: function() {
       var model = this.model,
-          column = this.column,
-          val = this.formatter.toRaw(this.$input.prop('checked'), model);
+        column = this.column,
+        val = this.formatter.toRaw(this.$input.prop('checked'), model);
 
       this.enterEditMode();
       // on bootstrap change we also need to change model's value
-      model.set(column.get("name"), val);
+      model.set(column.get('name'), val);
     },
 
-    render: function () {
-      var self = this, col = _.defaults(this.column.toJSON(), this.defaults),
-          attributes = this.model.toJSON(),
-          attrArr = col.name.split('.'),
-          name = attrArr.shift(),
-          path = attrArr.join('.'),
-          model = this.model, column = this.column,
-          rawValue = this.formatter.fromRaw(
-            model.get(column.get("name")), model
-          ),
-          editable = Backgrid.callByNeed(col.editable, column, model);
+    render: function() {
+      var self = this,
+        col = _.defaults(this.column.toJSON(), this.defaults),
+        model = this.model,
+        column = this.column,
+        rawValue = this.formatter.fromRaw(
+          model.get(column.get('name')), model
+        ),
+        editable = Backgrid.callByNeed(col.editable, column, model);
 
       this.undelegateEvents();
 
       this.$el.empty();
 
       this.$el.append(
-        $("<input>", {
+        $('<input>', {
           tabIndex: -1,
-          type: "checkbox"
-          }).prop('checked', rawValue).prop('disabled', !editable));
+          type: 'checkbox',
+        }).prop('checked', rawValue).prop('disabled', !editable));
       this.$input = this.$el.find('input[type=checkbox]').first();
 
       // Override BooleanCell checkbox with Bootstrapswitch
       this.$input.bootstrapSwitch(
-        _.defaults(
-          {'state': rawValue, 'disabled': !editable}, col.options,
+        _.defaults({
+          'state': rawValue,
+          'disabled': !editable,
+        }, col.options,
           this.defaults.options
-          ));
+        ));
 
       // Listen for Tab key
       this.$el.on('keydown', function(e) {
         var gotoCell;
-        if(e.keyCode == 9) {
+        if (e.keyCode == 9) {
           // go to Next Cell & if Shift is also pressed go to Previous Cell
           gotoCell = e.shiftKey ? self.$el.prev() : self.$el.next();
         }
 
-        if(gotoCell) {
-            setTimeout(function() {
-              if(gotoCell.hasClass('editable')) {
-                e.preventDefault();
-                e.stopPropagation();
-                var command = new Backgrid.Command({
-                      key: "Tab", keyCode: 9,
-                      which: 9, shiftKey: e.shiftKey
-                    });
-                self.model.trigger("backgrid:edited", self.model,
-                                    self.column, command);
-                gotoCell.focus();
-              }
-            }, 20);
+        if (gotoCell) {
+          setTimeout(function() {
+            if (gotoCell.hasClass('editable')) {
+              e.preventDefault();
+              e.stopPropagation();
+              var command = new Backgrid.Command({
+                key: 'Tab',
+                keyCode: 9,
+                which: 9,
+                shiftKey: e.shiftKey,
+              });
+              self.model.trigger('backgrid:edited', self.model,
+                self.column, command);
+              gotoCell.focus();
+            }
+          }, 20);
         }
 
       });
@@ -551,15 +547,14 @@
       this.delegateEvents();
 
       return this;
-    }
+    },
   });
 
   /*
    *  Select2Cell for backgrid.
    */
-  var Select2Cell = Backgrid.Extension.Select2Cell =
-      Backgrid.SelectCell.extend({
-    className: "select2-cell",
+  Backgrid.Extension.Select2Cell = Backgrid.SelectCell.extend({
+    className: 'select2-cell',
 
     /** @property */
     editor: null,
@@ -569,9 +564,9 @@
       opt: {
         label: null,
         value: null,
-        selected: false
-       }
-      }, Backgrid.SelectCell.prototype.defaults),
+        selected: false,
+      },
+    }, Backgrid.SelectCell.prototype.defaults),
 
     enterEditMode: function() {
       if (!this.$el.hasClass('editor'))
@@ -588,18 +583,19 @@
     },
 
     events: {
-      "select2:open": "enterEditMode",
-      "select2:close": "exitEditMode",
-      "change": "onSave",
-      "select2:unselect": "onSave"
+      'select2:open': 'enterEditMode',
+      'select2:close': 'exitEditMode',
+      'change': 'onSave',
+      'select2:unselect': 'onSave',
     },
     /** @property {function(Object, ?Object=): string} template */
     template: _.template([
       '<option value="<%- value %>" ',
       '<%= selected ? \'selected="selected"\' : "" %>>',
-      '<%- label %></option>'].join(''),
-      null,{
-        variable: null
+      '<%- label %></option>',
+    ].join(''),
+      null, {
+        variable: null,
       }),
 
     initialize: function() {
@@ -609,19 +605,20 @@
       this.exitEditMode = this.exitEditMode.bind(this);
     },
 
-    render: function () {
+    render: function() {
       var col = _.defaults(this.column.toJSON(), this.defaults),
-          model = this.model, column = this.column,
-          editable = Backgrid.callByNeed(col.editable, column, model),
-          optionValues = _.clone(this.optionValues ||
-                (_.isFunction(this.column.get('options')) ?
-                    (this.column.get('options'))(this) :
-                    this.column.get('options')));
+        model = this.model,
+        column = this.column,
+        editable = Backgrid.callByNeed(col.editable, column, model),
+        optionValues = _.clone(this.optionValues ||
+          (_.isFunction(this.column.get('options')) ?
+            (this.column.get('options'))(this) :
+            this.column.get('options')));
 
       this.undelegateEvents();
 
       if (this.$select) {
-        if ( this.$select.data('select2')) {
+        if (this.$select.data('select2')) {
           this.$select.select2('destroy');
         }
         delete this.$select;
@@ -631,7 +628,7 @@
       this.$el.empty();
 
       if (!_.isArray(optionValues))
-        throw new TypeError("optionValues must be an array");
+        throw new TypeError('optionValues must be an array');
 
       /*
        * Add empty option as Select2 requires any empty '<option><option>' for
@@ -640,18 +637,19 @@
       optionValues.unshift(this.defaults.opt);
 
       var optionText = null,
-          optionValue = null,
-          self = this,
-          model = this.model,
-          selectedValues = model.get(this.column.get("name")),
-          select2_opts = _.extend(
-            {openOnEnter: false, multiple:false}, self.defaults.select2,
-            (col.select2 || {})
-            ),
-          selectTpl = _.template('<select <%=multiple ? "multiple" : "" %>></select>');
+        optionValue = null,
+        self = this,
+        selectedValues = model.get(this.column.get('name')),
+        select2_opts = _.extend({
+          openOnEnter: false,
+          multiple: false,
+        }, self.defaults.select2,
+          (col.select2 || {})
+        ),
+        selectTpl = _.template('<select <%=multiple ? "multiple" : "" %>></select>');
 
       var $select = self.$select = $(selectTpl({
-        multiple: select2_opts.multiple
+        multiple: select2_opts.multiple,
       })).appendTo(self.$el);
 
       for (var i = 0; i < optionValues.length; i++) {
@@ -659,37 +657,49 @@
 
         if (_.isArray(opt)) {
 
-          optionText  = opt[0];
+          optionText = opt[0];
           optionValue = opt[1];
 
           $select.append(
             self.template({
-               label: optionText,
-               value: optionValue,
-               selected: (selectedValues == optionValue) ||
-                 (select2_opts.multiple && _.indexOf(selectedValues, optionValue) > -1)
+              label: optionText,
+              value: optionValue,
+              selected: (selectedValues == optionValue) ||
+                (select2_opts.multiple && _.indexOf(selectedValues, optionValue) > -1),
             }));
-         } else {
+        } else {
           opt = _.defaults({}, opt, {
             selected: ((selectedValues == opt.value) ||
-                (select2_opts.multiple && _.indexOf(selectedValues, opt.value) > -1)),
-            }, self.defaults.opt);
+              (select2_opts.multiple && _.indexOf(selectedValues, opt.value) > -1)),
+          }, self.defaults.opt);
           $select.append(self.template(opt));
         }
       }
 
-      if(col && _.has(col.disabled)) {
+      if (col && _.has(col.disabled)) {
+        var evalF = function() {
+          var args = [];
+          Array.prototype.push.apply(args, arguments);
+          var f = args.shift();
+
+          if (typeof(f) === 'function') {
+            return f.apply(self, args);
+          }
+          return f;
+        };
         _.extend(select2_opts, {
-          disabled: evalF(col.disabled, col, model)
+          disabled: evalF(col.disabled, col, model),
         });
       } else {
-        _.extend(select2_opts, {disabled: !editable});
+        _.extend(select2_opts, {
+          disabled: !editable,
+        });
       }
 
       this.delegateEvents();
 
       // If disabled then no need to show placeholder
-      if(!editable || col.mode === 'properties') {
+      if (!editable || col.mode === 'properties') {
         select2_opts['placeholder'] = '';
       }
 
@@ -698,7 +708,7 @@
 
       // Select the highlighted item on Tab press.
       if (this.$sel) {
-        this.$sel.data('select2').on("keypress", function(ev) {
+        this.$sel.data('select2').on('keypress', function(ev) {
           var self = this;
 
           // keycode 9 is for TAB key
@@ -713,13 +723,13 @@
     },
 
     /**
-       Saves the value of the selected option to the model attribute.
-    */
-    onSave: function (e) {
+         Saves the value of the selected option to the model attribute.
+         */
+    onSave: function() {
       var model = this.model;
       var column = this.column;
 
-      model.set(column.get("name"), this.$select.val());
+      model.set(column.get('name'), this.$select.val());
     },
 
     remove: function() {
@@ -729,7 +739,7 @@
       }
       this.$el.empty();
       Backgrid.SelectCell.prototype.remove.apply(this, arguments);
-    }
+    },
   });
 
   /**
@@ -741,12 +751,12 @@
   */
   var TextareaCellEditor = Backgrid.TextareaCellEditor = Backgrid.InputCellEditor.extend({
     /** @property */
-    tagName: "textarea",
+    tagName: 'textarea',
 
     events: {
-      "blur": "saveOrCancel",
-      "keydown": ""
-    }
+      'blur': 'saveOrCancel',
+      'keydown': '',
+    },
   });
 
   /**
@@ -755,43 +765,42 @@
       @class Backgrid.Extension.TextareaCell
       @extends Backgrid.Cell
   */
-  var TextareaCell = Backgrid.Extension.TextareaCell = Backgrid.Cell.extend({
+  Backgrid.Extension.TextareaCell = Backgrid.Cell.extend({
     /** @property */
-    className: "textarea-cell",
+    className: 'textarea-cell',
 
-    editor: TextareaCellEditor
+    editor: TextareaCellEditor,
   });
 
 
   /**
    * Custom header icon cell to add the icon in table header.
-  */
-  var CustomHeaderIconCell = Backgrid.Extension.CustomHeaderIconCell = Backgrid.HeaderCell.extend({
-      /** @property */
-      className: "header-icon-cell",
-      events: {
-        "click": "addHeaderIcon"
-      },
-      addHeaderIcon: function (e) {
-        var self = this,
-        m = new (this.collection.model);
-        this.collection.add(m)
-        e.preventDefault();
-      },
-      render: function () {
-          this.$el.empty();
-          //this.$el.html("<i class='fa fa-plus-circle'></i>");
-          this.$el.html("<label><a><span style='font-weight:normal;'>Array Values</a></span></label> <button class='btn-sm btn-default add'>Add</button>");
-          this.delegateEvents();
-          return this;
-      }
+   */
+  Backgrid.Extension.CustomHeaderIconCell = Backgrid.HeaderCell.extend({
+    /** @property */
+    className: 'header-icon-cell',
+    events: {
+      'click': 'addHeaderIcon',
+    },
+    addHeaderIcon: function(e) {
+      this.collection.add(
+        new(this.collection.model)
+      );
+      e.preventDefault();
+    },
+    render: function() {
+      this.$el.empty();
+      //this.$el.html("<i class='fa fa-plus-circle'></i>");
+      this.$el.html('<label><a><span style=\'font-weight:normal;\'>Array Values</a></span></label> <button class=\'btn-sm btn-default add\'>Add</button>');
+      this.delegateEvents();
+      return this;
+    },
   });
 
-
   var arrayCellModel = Backbone.Model.extend({
     defaults: {
-        value: undefined
-    }
+      value: undefined,
+    },
   });
 
   /**
@@ -799,119 +808,125 @@
    */
   var InputArrayCellEditor = Backgrid.Extension.InputArrayCellEditor =
     Backgrid.CellEditor.extend({
-      tagName: "div",
+      tagName: 'div',
 
-    events: {
-      'blur': 'lostFocus'
-    },
+      events: {
+        'blur': 'lostFocus',
+      },
 
-    render: function () {
+      render: function() {
         var self = this,
-            arrayValuesCol = this.model.get(this.column.get("name")),
-            tbl = $("<table></table>").appendTo(this.$el),
-            gridCols = [
-                    {name: 'value', label: gettext('Array Values'), type: 'text', cell:'string', headerCell: Backgrid.Extension.CustomHeaderIconCell, cellHeaderClasses: 'width_percent_100'},
-                    ],
-            gridBody = $("<div class='pgadmin-control-group backgrid form-group col-xs-12 object subnode'></div>");
+          arrayValuesCol = this.model.get(this.column.get('name')),
+          gridCols = [{
+            name: 'value',
+            label: gettext('Array Values'),
+            type: 'text',
+            cell: 'string',
+            headerCell: Backgrid.Extension.CustomHeaderIconCell,
+            cellHeaderClasses: 'width_percent_100',
+          }],
+          gridBody = $('<div class=\'pgadmin-control-group backgrid form-group col-xs-12 object subnode\'></div>');
 
         this.$el.attr('tabindex', '1');
 
         gridCols.unshift({
-          name: "pg-backform-delete", label: "",
+          name: 'pg-backform-delete',
+          label: '',
           cell: Backgrid.Extension.DeleteCell,
           //headerCell: Backgrid.Extension.CustomHeaderIconCell,
-          editable: false, cell_priority: -1
+          editable: false,
+          cell_priority: -1,
         });
 
-      this.$el.empty();
-      var grid = self.grid = new Backgrid.Grid({
-            columns: gridCols,
-            collection:arrayValuesCol
-          });
-
-      grid.render();
+        this.$el.empty();
+        var grid = self.grid = new Backgrid.Grid({
+          columns: gridCols,
+          collection: arrayValuesCol,
+        });
 
-      gridBody.append(grid.$el)
+        grid.render();
 
-      this.$el.html(gridBody);
+        gridBody.append(grid.$el);
 
-      $(self.$el).pgMakeVisible('backform-tab');
-      self.delegateEvents();
+        this.$el.html(gridBody);
 
-      return this;
-    },
+        $(self.$el).pgMakeVisible('backform-tab');
+        self.delegateEvents();
 
-    /*
-     * Call back function when the grid lost the focus
-     */
-    lostFocus: function(ev) {
+        return this;
+      },
 
-      var self = this,
-      /*
-       * Function to determine whether one dom element is descendant of another
-       * dom element.
-       */
-      isDescendant = function (parent, child) {
-         var node = child.parentNode;
-         while (node != null) {
-             if (node == parent) {
-                 return true;
-             }
-             node = node.parentNode;
-         }
-         return false;
-      }
       /*
-       * Between leaving the old element focus and entering the new element focus the
-       * active element is the document/body itself so add timeout to get the proper
-       * focused active element.
+       * Call back function when the grid lost the focus
        */
-      setTimeout(function() {
-        if (self.$el[0] != document.activeElement && !isDescendant(self.$el[0], document.activeElement)){
-          var m = self.model,
-            column = self.column;
-          m.trigger('backgrid:edited', m, column, new Backgrid.Command(ev));
+      lostFocus: function(ev) {
+
+        var self = this,
+          /*
+           * Function to determine whether one dom element is descendant of another
+           * dom element.
+           */
+          isDescendant = function(parent, child) {
+            var node = child.parentNode;
+            while (node != null) {
+              if (node == parent) {
+                return true;
+              }
+              node = node.parentNode;
+            }
+            return false;
+          };
+        /*
+         * Between leaving the old element focus and entering the new element focus the
+         * active element is the document/body itself so add timeout to get the proper
+         * focused active element.
+         */
+        setTimeout(function() {
+          if (self.$el[0] != document.activeElement && !isDescendant(self.$el[0], document.activeElement)) {
+            var m = self.model,
+              column = self.column;
+            m.trigger('backgrid:edited', m, column, new Backgrid.Command(ev));
 
-          setTimeout(function(){
-            if (self.grid) {
+            setTimeout(function() {
+              if (self.grid) {
                 self.grid.remove();
                 self.grid = null;
-            }
-          }, 10);
+              }
+            }, 10);
 
 
-        } },10);
-      return;
-    }
-  });
+          }
+        }, 10);
+        return;
+      },
+    });
 
   /*
    * This will help us transform the user input string array values in proper format to be
    * displayed in the cell.
    */
   var InputStringArrayCellFormatter = Backgrid.Extension.InputStringArrayCellFormatter =
-    function () {};
+    function() {};
   _.extend(InputStringArrayCellFormatter.prototype, {
     /**
      * Takes a raw value from a model and returns an optionally formatted
      * string for display.
      */
-    fromRaw: function (rawData, model) {
-        var values = []
-        rawData.each(function(m){
-            var val = m.get('value');
-            if (_.isUndefined(val)) {
-                values.push("null");
-            } else {
-                values.push(m.get("value"));
-            }
-          }
-        );
-        return values.toString();
+    fromRaw: function(rawData) {
+      var values = [];
+      rawData.each(function(m) {
+        var val = m.get('value');
+        if (_.isUndefined(val)) {
+          values.push('null');
+        } else {
+          values.push(m.get('value'));
+        }
+      });
+      return values.toString();
     },
-    toRaw: function (formattedData, model) {
+    toRaw: function(formattedData) {
       return formattedData;
-    }
+    },
   });
 
   /*
@@ -919,78 +934,81 @@
    * displayed in the cell.
    */
   var InputIntegerArrayCellFormatter = Backgrid.Extension.InputIntegerArrayCellFormatter =
-    function () {};
+    function() {};
   _.extend(InputIntegerArrayCellFormatter.prototype, {
     /**
      * Takes a raw value from a model and returns an optionally formatted
      * string for display.
      */
-    fromRaw: function (rawData, model) {
-        var values = []
-        rawData.each(function(m){
-            var val = m.get('value');
-            if (_.isUndefined(val)) {
-                values.push("null");
-            } else {
-                values.push(m.get("value"));
-            }
-          }
-        );
-        return values.toString();
+    fromRaw: function(rawData) {
+      var values = [];
+      rawData.each(function(m) {
+        var val = m.get('value');
+        if (_.isUndefined(val)) {
+          values.push('null');
+        } else {
+          values.push(m.get('value'));
+        }
+      });
+      return values.toString();
     },
-    toRaw: function (formattedData, model) {
-        formattedData.each(function(m){
-            m.set("value", parseInt(m.get('value')), {silent: true});
+    toRaw: function(formattedData) {
+      formattedData.each(function(m) {
+        m.set('value', parseInt(m.get('value')), {
+          silent: true,
         });
+      });
 
       return formattedData;
-    }
+    },
   });
 
   /*
    *  InputStringArrayCell for rendering and taking input for string array type in debugger
    */
-  var InputStringArrayCell = Backgrid.Extension.InputStringArrayCell = Backgrid.Cell.extend({
-    className: "width_percent_25",
+  Backgrid.Extension.InputStringArrayCell = Backgrid.Cell.extend({
+    className: 'width_percent_25',
     formatter: InputStringArrayCellFormatter,
     editor: InputArrayCellEditor,
 
     initialize: function() {
       Backgrid.Cell.prototype.initialize.apply(this, arguments);
-        // set value to empty array.
-        var m = arguments[0].model;
-        if (_.isUndefined(this.collection)) {
-            this.collection = new (Backbone.Collection.extend({
-            model: arrayCellModel}))(m.get('value'));
-        }
+      // set value to empty array.
+      var m = arguments[0].model;
+      if (_.isUndefined(this.collection)) {
+        this.collection = new(Backbone.Collection.extend({
+          model: arrayCellModel,
+        }))(m.get('value'));
+      }
 
-        this.model.set(this.column.get('name'), this.collection);
+      this.model.set(this.column.get('name'), this.collection);
 
-        this.listenTo(this.collection, "remove", this.render);
+      this.listenTo(this.collection, 'remove', this.render);
     },
   });
 
   /*
    *  InputIntegerArrayCell for rendering and taking input for integer array type in debugger
    */
-  var InputIntegerArrayCell = Backgrid.Extension.InputIntegerArrayCell = Backgrid.Cell.extend({
-    className: "width_percent_25",
+  Backgrid.Extension.InputIntegerArrayCell = Backgrid.Cell.extend({
+    className: 'width_percent_25',
     formatter: InputIntegerArrayCellFormatter,
     editor: InputArrayCellEditor,
 
     initialize: function() {
       Backgrid.Cell.prototype.initialize.apply(this, arguments);
-        // set value to empty array.
-        var m = arguments[0].model;
-        if (_.isUndefined(this.collection)) {
-            this.collection = new (Backbone.Collection.extend({
-            model: arrayCellModel}))(m.get('value'));
-        }
+      // set value to empty array.
+      var m = arguments[0].model;
+      if (_.isUndefined(this.collection)) {
+        this.collection = new(Backbone.Collection.extend({
+          model: arrayCellModel,
+        }))(m.get('value'));
+      }
 
 
-        this.model.set(this.column.get('name'),this.collection);
+      this.model.set(this.column.get('name'), this.collection);
 
-        this.listenTo(this.collection, "remove", this.render);
+      this.listenTo(this.collection, 'remove', this.render);
     },
   });
 
@@ -1006,7 +1024,7 @@
 
   _.extend(
     DependentCell.prototype, {
-      initialize: function(){
+      initialize: function() {
         // Listen to the dependent fields in the model for any change
         var deps = this.column.get('deps');
         var self = this;
@@ -1014,8 +1032,8 @@
         if (deps && _.isArray(deps)) {
           _.each(deps, function(d) {
             var attrArr = d.split('.'),
-            name = attrArr.shift();
-            self.listenTo(self.model, "change:" + name, self.dependentChanged);
+              name = attrArr.shift();
+            self.listenTo(self.model, 'change:' + name, self.dependentChanged);
           });
         }
       },
@@ -1029,10 +1047,10 @@
             var attrArr = d.split('.'),
               name = attrArr.shift();
 
-            self.stopListening(self.model, "change:" + name, self.dependentChanged);
+            self.stopListening(self.model, 'change:' + name, self.dependentChanged);
           });
         }
-      }
+      },
     });
 
   /**
@@ -1042,36 +1060,36 @@
    @extends Backgrid.CellFormatter
    @constructor
   */
-  var PasswordFormatter = Backgrid.PasswordFormatter = function () {};
+  var PasswordFormatter = Backgrid.PasswordFormatter = function() {};
   PasswordFormatter.prototype = new Backgrid.CellFormatter();
   _.extend(PasswordFormatter.prototype, {
-    fromRaw: function (rawValue, model) {
+    fromRaw: function(rawValue) {
 
       if (_.isUndefined(rawValue) || _.isNull(rawValue)) return '';
 
       var pass = '';
-      for(var i = 0; i < rawValue.length; i++) {
+      for (var i = 0; i < rawValue.length; i++) {
         pass += '*';
       }
       return pass;
-    }
+    },
   });
 
-  var PasswordCell = Backgrid.Extension.PasswordCell  = Backgrid.StringCell.extend({
+  Backgrid.Extension.PasswordCell = Backgrid.StringCell.extend({
 
     formatter: PasswordFormatter,
 
     editor: Backgrid.InputCellEditor.extend({
       attributes: {
-        type: "password"
+        type: 'password',
       },
 
-      render: function () {
+      render: function() {
         var model = this.model;
-        this.$el.val(model.get(this.column.get("name")));
+        this.$el.val(model.get(this.column.get('name')));
         return this;
-      }
-    })
+      },
+    }),
   });
 
   /*
@@ -1081,7 +1099,7 @@
    * and we need to parse it again in float at client side.
    */
   _.extend(Backgrid.NumberFormatter.prototype, {
-    fromRaw: function (number, model) {
+    fromRaw: function(number) {
       if (_.isNull(number) || _.isUndefined(number)) return '';
 
       number = parseFloat(number).toFixed(~~this.decimals);
@@ -1091,64 +1109,64 @@
       var decimalPart = parts[1] ? (this.decimalSeparator || '.') + parts[1] : '';
 
       return integerPart.replace(this.HUMANIZED_NUM_RE, '$1' + this.orderSeparator) + decimalPart;
-    }
+    },
   });
 
   /*
    *  JSONBCell Formatter.
    */
   var JSONBCellFormatter = Backgrid.Extension.JSONBCellFormatter =
-    function () {};
+    function() {};
   _.extend(JSONBCellFormatter.prototype, {
-    fromRaw: function (rawData, model) {
-        // json data
-        if(_.isArray(rawData)) {
-          var converted_data = '';
-          converted_data = _.map(rawData, function(data) {
-            return JSON.stringify(JSON.stringify(data));
-          });
-          return '{' + converted_data.join() + '}';
-        } else if(_.isObject(rawData)) {
-          return JSON.stringify(rawData);
-        } else {
-          return rawData;
-        }
+    fromRaw: function(rawData) {
+      // json data
+      if (_.isArray(rawData)) {
+        var converted_data = '';
+        converted_data = _.map(rawData, function(data) {
+          return JSON.stringify(JSON.stringify(data));
+        });
+        return '{' + converted_data.join() + '}';
+      } else if (_.isObject(rawData)) {
+        return JSON.stringify(rawData);
+      } else {
+        return rawData;
+      }
     },
-    toRaw: function (formattedData, model) {
+    toRaw: function(formattedData) {
       return formattedData;
-    }
+    },
   });
 
   /*
    *  JSONBCell for backgrid.
    */
-  var JSONBCell = Backgrid.Extension.JSONBCell =
-      Backgrid.StringCell.extend({
-        className: "jsonb-cell",
-        formatter: JSONBCellFormatter
-      });
+  Backgrid.Extension.JSONBCell =
+    Backgrid.StringCell.extend({
+      className: 'jsonb-cell',
+      formatter: JSONBCellFormatter,
+    });
 
-  var DatepickerCell = Backgrid.Extension.DatepickerCell = Backgrid.Cell.extend({
-    editor: DatepickerCellEditor
+  Backgrid.Extension.DatepickerCell = Backgrid.Cell.extend({
+    editor: DatepickerCellEditor,
   });
 
   var DatepickerCellEditor = Backgrid.InputCellEditor.extend({
-    events:{},
-    initialize:function() {
+    events: {},
+    initialize: function() {
       Backgrid.InputCellEditor.prototype.initialize.apply(this, arguments);
       var input = this;
       $(this.el).prop('readonly', true);
       $(this.el).datepicker({
-        onClose: function(newValue){
+        onClose: function(newValue) {
           var command = new Backgrid.Command({});
-          input.model.set(input.column.get("name"), newValue);
+          input.model.set(input.column.get('name'), newValue);
           input.model.trigger(
-            "backgrid:edited", input.model, input.column, command
+            'backgrid:edited', input.model, input.column, command
           );
           command = input = null;
-        }
+        },
       });
-    }
+    },
   });
 
   // Reference:
@@ -1163,7 +1181,7 @@
    @extends Backgrid.CellFormatter
    @constructor
    */
-  var MomentFormatter = Backgrid.Extension.MomentFormatter = function (options) {
+  var MomentFormatter = Backgrid.Extension.MomentFormatter = function(options) {
     _.extend(this, this.defaults, options);
   };
 
@@ -1207,7 +1225,7 @@
       displayInUTC: true,
       displayLang: moment.locale(),
       displayFormat: moment.defaultFormat,
-      allowEmpty: false
+      allowEmpty: false,
     },
 
     /**
@@ -1216,7 +1234,7 @@
        @param {*} rawData
        @return {string}
        */
-    fromRaw: function (rawData) {
+    fromRaw: function(rawData) {
       if (rawData == null) return '';
 
       var m = this.modelInUnixOffset ? moment(rawData) :
@@ -1231,7 +1249,8 @@
 
       if (this.displayLang) m.locale(this.displayLang);
 
-      if (this.displayInUTC) m.utc(); else m.local();
+      if (this.displayInUTC) m.utc();
+      else m.local();
 
       if (this.displayFormat != moment.defaultFormat) {
         return m.format(this.displayFormat);
@@ -1246,7 +1265,7 @@
        @param {string} formattedData
        @return {string}
        */
-    toRaw: function (formattedData) {
+    toRaw: function(formattedData) {
 
       var m = this.displayInUnixOffset ? moment(+formattedData) :
         this.displayInUnixTimestamp ? moment.unix(+formattedData) :
@@ -1262,14 +1281,15 @@
 
       if (this.modelLang) m.locale(this.modelLang);
 
-      if (this.modelInUTC) m.utc(); else m.local()
+      if (this.modelInUTC) m.utc();
+      else m.local();
 
       if (this.modelFormat != moment.defaultFormat) {
         return m.format(this.modelFormat);
       }
 
       return m.format();
-    }
+    },
   });
 
   var MomentCell = Backgrid.Extension.MomentCell = Backgrid.Cell.extend({
@@ -1277,7 +1297,7 @@
     editor: Backgrid.InputCellEditor,
 
     /** @property */
-    className: "datetime-cell",
+    className: 'datetime-cell',
 
     /** @property {Backgrid.CellFormatter} [formatter=Backgrid.Extension.MomentFormatter] */
     formatter: MomentFormatter,
@@ -1286,7 +1306,7 @@
        Initializer. Accept Backgrid.Extension.MomentFormatter.options and
        Backgrid.Cell.initialize required parameters.
      */
-    initialize: function (options) {
+    initialize: function(options) {
 
       MomentCell.__super__.initialize.apply(this, arguments);
 
@@ -1306,68 +1326,73 @@
 
       this.editor = this.editor.extend({
         attributes: _.extend({}, this.editor.prototype.attributes || this.editor.attributes || {}, {
-          placeholder: this.formatter.displayFormat
+          placeholder: this.formatter.displayFormat,
         }),
-        options: this.column.get('options')
+        options: this.column.get('options'),
       });
-    }
+    },
   });
 
-  var DatetimePickerEditor = Backgrid.Extension.DatetimePickerEditor = Backgrid.InputCellEditor.extend({
+  Backgrid.Extension.DatetimePickerEditor = Backgrid.InputCellEditor.extend({
     postRender: function() {
       var self = this,
-          evalF = function() {
-            var args = [];
-            Array.prototype.push.apply(args, arguments);
-            var f = args.shift();
+        evalF = function() {
+          var args = [];
+          Array.prototype.push.apply(args, arguments);
+          var f = args.shift();
 
-            if (typeof(f) === 'function') {
-              return f.apply(self, args);
-            }
-            return f;
-          },
-          options = _.extend({
-            format: "YYYY-MM-DD HH:mm:ss Z",
-            showClear: true,
-            showTodayButton: true,
-            toolbarPlacement: 'top'
-          }, evalF(this.column.get('options')), {
-            keyBinds: {
-              "shift tab": function(widget) {
-                if (widget) {
-                  // blur the input
-                  setTimeout(
-                    function() {
-                      self.closeIt({keyCode: 9, shiftKey: true});
-                    }, 10
-                  );
-                }
-              },
-              tab: function(widget) {
-                if (widget) {
-                  // blur the input
-                  setTimeout(
-                    function() {
-                      self.closeIt({keyCode: 9});
-                    }, 10
-                  );
-                }
+          if (typeof(f) === 'function') {
+            return f.apply(self, args);
+          }
+          return f;
+        },
+        options = _.extend({
+          format: 'YYYY-MM-DD HH:mm:ss Z',
+          showClear: true,
+          showTodayButton: true,
+          toolbarPlacement: 'top',
+        }, evalF(this.column.get('options')), {
+          keyBinds: {
+            'shift tab': function(widget) {
+              if (widget) {
+                // blur the input
+                setTimeout(
+                  function() {
+                    self.closeIt({
+                      keyCode: 9,
+                      shiftKey: true,
+                    });
+                  }, 10
+                );
               }
-            }
-          });
+            },
+            tab: function(widget) {
+              if (widget) {
+                // blur the input
+                setTimeout(
+                  function() {
+                    self.closeIt({
+                      keyCode: 9,
+                    });
+                  }, 10
+                );
+              }
+            },
+          },
+        });
       this.$el.datetimepicker(options);
       this.$el.datetimepicker('show');
       this.picker = this.$el.data('DateTimePicker');
     },
     events: {
-      'dp.hide': 'closeIt'
+      'dp.hide': 'closeIt',
     },
     closeIt: function(ev) {
       var formatter = this.formatter,
-          model = this.model,
-          column = this.column,
-          val = this.$el.val(),
-          newValue = formatter.toRaw(val, model);
+        model = this.model,
+        column = this.column,
+        val = this.$el.val(),
+        newValue = formatter.toRaw(val, model);
 
       if (this.is_closing)
         return;
@@ -1378,44 +1403,47 @@
       var command = new Backgrid.Command(ev);
 
       if (_.isUndefined(newValue)) {
-        model.trigger("backgrid:error", model, column, val);
+        model.trigger('backgrid:error', model, column, val);
       } else {
-        model.set(column.get("name"), newValue);
-        model.trigger("backgrid:edited", model, column, command);
+        model.set(column.get('name'), newValue);
+        model.trigger('backgrid:edited', model, column, command);
       }
-    }
+    },
   });
 
   _.extend(MomentCell.prototype, MomentFormatter.prototype.defaults);
 
 
   Backgrid.Extension.StringDepCell = Backgrid.StringCell.extend({
-      initialize: function() {
-        Backgrid.StringCell.prototype.initialize.apply(this, arguments);
-        Backgrid.Extension.DependentCell.prototype.initialize.apply(this, arguments);
-      },
-      dependentChanged: function () {
-        this.$el.empty();
+    initialize: function() {
+      Backgrid.StringCell.prototype.initialize.apply(this, arguments);
+      Backgrid.Extension.DependentCell.prototype.initialize.apply(this, arguments);
+    },
+    dependentChanged: function() {
+      this.$el.empty();
 
-        var self = this,
-            model = this.model,
-            column = this.column,
-            editable = this.column.get("editable");
+      var self = this,
+        model = this.model,
+        column = this.column,
+        editable = this.column.get('editable');
 
-        this.render();
+      this.render();
 
-        var is_editable = _.isFunction(editable) ? !!editable.apply(column, [model]) : !!editable;
-        setTimeout(function() {
-          self.$el.removeClass("editor");
-          if (is_editable){ self.$el.addClass("editable"); }
-          else { self.$el.removeClass("editable"); }
-        }, 10);
+      var is_editable = _.isFunction(editable) ? !!editable.apply(column, [model]) : !!editable;
+      setTimeout(function() {
+        self.$el.removeClass('editor');
+        if (is_editable) {
+          self.$el.addClass('editable');
+        } else {
+          self.$el.removeClass('editable');
+        }
+      }, 10);
 
-        this.delegateEvents();
-        return this;
-      },
-      remove: Backgrid.Extension.DependentCell.prototype.remove
-    });
+      this.delegateEvents();
+      return this;
+    },
+    remove: Backgrid.Extension.DependentCell.prototype.remove,
+  });
 
   Backgrid.Extension.Select2DepCell = Backgrid.Extension.Select2Cell.extend({
     initialize: function() {
@@ -1423,23 +1451,28 @@
       Backgrid.Extension.DependentCell.prototype.initialize.apply(this, arguments);
     },
 
-    dependentChanged: function () {
-      var model = this.model;
-      var column = this.column;
-      editable = this.column.get("editable");
+    dependentChanged: function() {
+      var model = this.model,
+        column = this.column,
+        editable = this.column.get('editable');
 
       this.render();
 
-      is_editable = _.isFunction(editable) ? !!editable.apply(column, [model]) : !!editable;
-      if (is_editable){ this.$el.addClass("editable"); }
-      else { this.$el.removeClass("editable"); }
+      if (
+        _.isFunction(editable) ? !!editable.apply(column, [model]) :
+        !!editable
+      ) {
+        this.$el.addClass('editable');
+      } else {
+        this.$el.removeClass('editable');
+      }
 
       this.delegateEvents();
       return this;
     },
-    remove: Backgrid.Extension.DependentCell.prototype.remove
+    remove: Backgrid.Extension.DependentCell.prototype.remove,
   });
 
   return Backgrid;
 
-}));
+});
diff --git a/web/pgadmin/static/js/check_node_visibility.js b/web/pgadmin/static/js/check_node_visibility.js
index 73ce18f0..e7f9cdc5 100644
--- a/web/pgadmin/static/js/check_node_visibility.js
+++ b/web/pgadmin/static/js/check_node_visibility.js
@@ -18,27 +18,27 @@ define(['jquery', 'underscore', 'underscore.string'],
       // Target actual node instead of collection.
       // If node is disabled then there is no meaning of
       // adding collection node menu
-      if(S.startsWith(node_type, "coll-")) {
-        node_type = node_type.replace("coll-", "")
+      if(S.startsWith(node_type, 'coll-')) {
+        node_type = node_type.replace('coll-', '');
       }
 
       // Exclude non-applicable nodes
       var nodes_not_supported = [
-        "server_group", "server", "catalog_object_column"
+        'server_group', 'server', 'catalog_object_column',
       ];
       if(_.indexOf(nodes_not_supported, node_type) >= 0) {
         return true;
       }
 
-      var preference = pgBrowser.get_preference("browser", 'show_node_'+node_type);
+      var preference = pgBrowser.get_preference('browser', 'show_node_'+node_type);
 
       if (preference) {
-        return preference.value
+        return preference.value;
       }
       else {
         return true;
       }
-    }
+    };
 
-  return check_node_visibility;
-});
+    return check_node_visibility;
+  });
diff --git a/web/pgadmin/static/js/codemirror/addon/fold/pgadmin-sqlfoldcode.js b/web/pgadmin/static/js/codemirror/addon/fold/pgadmin-sqlfoldcode.js
index f0e9eccc..8adf864d 100644
--- a/web/pgadmin/static/js/codemirror/addon/fold/pgadmin-sqlfoldcode.js
+++ b/web/pgadmin/static/js/codemirror/addon/fold/pgadmin-sqlfoldcode.js
@@ -1,37 +1,47 @@
 (function(mod) {
-  if (typeof exports == "object" && typeof module == "object") // CommonJS
-    mod(require("codemirror"));
-  else if (typeof define == "function" && define.amd) // AMD
-    define(["codemirror"], mod);
+  if (typeof exports == 'object' && typeof module == 'object') // CommonJS
+    mod(require('codemirror'));
+  else if (typeof define == 'function' && define.amd) // AMD
+    define(['codemirror'], mod);
   else // Plain browser env
-    mod(CodeMirror);
+    mod(window.CodeMirror);
 })(function(CodeMirror) {
-  "use strict";
+  'use strict';
 
   CodeMirror.pgadminKeywordRangeFinder = function(cm, start, startTkn, endTkn) {
-    var line = start.line, lineText = cm.getLine(line);
-    var at = lineText.length, startChar, tokenType;
+    var line = start.line,
+      lineText = cm.getLine(line);
+    var at = lineText.length,
+      startChar, tokenType;
     for (; at > 0;) {
       var found = lineText.lastIndexOf(startTkn, at);
       var startToken = startTkn;
       var endToken = endTkn;
+
       if (found < start.ch) {
-        var found = lineText.lastIndexOf("[", at);
+        found = lineText.lastIndexOf('[', at);
         if (found < start.ch) break;
-        var startToken = '[';
-        var endToken = ']';
+        startToken = '[';
+        endToken = ']';
       }
 
       tokenType = cm.getTokenAt(CodeMirror.Pos(line, found + 1)).type;
-      if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }
+      if (!/^(comment|string)/.test(tokenType)) {
+        startChar = found;
+        break;
+      }
       at = found - 1;
     }
     if (startChar == null || lineText.lastIndexOf(startToken) > startChar) return;
-    var count = 1, lastLine = cm.lineCount(), end, endCh;
+    var count = 1,
+      lastLine = cm.lineCount(),
+      end, endCh;
     outer: for (var i = line + 1; i < lastLine; ++i) {
-      var text = cm.getLine(i), pos = 0;
+      var text = cm.getLine(i),
+        pos = 0;
       for (;;) {
-        var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
+        var nextOpen = text.indexOf(startToken, pos),
+          nextClose = text.indexOf(endToken, pos);
         if (nextOpen < 0) nextOpen = text.length;
         if (nextClose < 0) nextClose = text.length;
         pos = Math.min(nextOpen, nextClose);
@@ -48,8 +58,10 @@
       }
     }
     if (end == null || end == line + 1) return;
-    return {from: CodeMirror.Pos(line, startChar + startTkn.length),
-          to: CodeMirror.Pos(end, endCh)};
+    return {
+      from: CodeMirror.Pos(line, startChar + startTkn.length),
+      to: CodeMirror.Pos(end, endCh),
+    };
   };
 
   CodeMirror.pgadminBeginRangeFinder = function(cm, start) {
diff --git a/web/pgadmin/static/js/gettext.js b/web/pgadmin/static/js/gettext.js
index 780b60f3..8ccd3285 100644
--- a/web/pgadmin/static/js/gettext.js
+++ b/web/pgadmin/static/js/gettext.js
@@ -1,4 +1,4 @@
-define(["translations"], function (translations) {
+define(['translations'], function (translations) {
 
   /***
    * This method behaves as a drop-in replacement for flask translation rendering.
diff --git a/web/pgadmin/static/js/pgadmin.js b/web/pgadmin/static/js/pgadmin.js
index 7ab1e3fc..f0f93d9a 100644
--- a/web/pgadmin/static/js/pgadmin.js
+++ b/web/pgadmin/static/js/pgadmin.js
@@ -1,57 +1,95 @@
-(function (factory) {
-  if (typeof define === 'function' && define.amd) {
-    // AMD. Register as an anonymous module.
-    define([], factory);
-  } else if(typeof module !== 'undefined' && module.exports) {
-    // CommonJS
-    module.exports = factory();
-  } else {
-    // Browser globals
-    factory();
-  }
-}(function(){
+define([], function() {
   var pgAdmin = window.pgAdmin = window.pgAdmin || {};
 
   // Reference:
   // https://github.com/heygrady/Units/blob/master/Length.min.js
   // Changed it to save the function in pgAdmin object.
-  (function(t,e,o) {"use strict";function r(t,e,r,p){r=r||"width";var n,l,m,c=(e.match(s)||[])[2],f="px"===c?1:d[c+"toPx"],u=/r?em/i;if(f||u.test(c)&&!p)t=f?t:"rem"===c?i:"fontSize"===r?t.parentNode||t:t,f=f||parseFloat(a(t,"fontSize")),m=parseFloat(e)*f;else{n=t.style,l=n[r];try{n[r]=e}catch(x){return 0}m=n[r]?parseFloat(a(t,r)):0,n[r]=l!==o?l:null}return m}function a(t,e){var o,n,i,l,d,c=/^top|bottom/,f=["paddingTop","paddingBottom","borderTop","borderBottom"],u=4;if(o=m?m(t)[e]:(n=t.style["pixel"+e.charAt(0).toUpperCase()+e.slice(1)])?n+"px":"fontSize"===e?r(t,"1em","left",1)+"px":t.currentStyle[e],i=(o.match(s)||[])[2],"%"===i&&p)if(c.test(e)){for(l=(d=t.parentNode||t).offsetHeight;u--;)l-=parseFloat(a(d,f[u]));o=parseFloat(o)/100*l+"px"}else o=r(t,o);else("auto"===o||i&&"px"!==i)&&m?o=0:i&&"px"!==i&&!m&&(o=r(t,o)+"px");return o}var p,n=e.createElement("test"),i=e.documentElement,l=e.defaultView,m=l&&l.getComputedStyle,s=/^(-?[\d+\.\-]+)([a-z]+|%)$/i,d={},c=[1/25.4,1/2.54,1/72,1/6],f=["mm","cm","pt","pc","in","mozmm"],u=6;for(i.appendChild(n),m&&(n.style.marginTop="1%",p="1%"===m(n).marginTop);u--;)d[f[u]+"toPx"]=c[u]?c[u]*d.inToPx:r(n,"1"+f[u]);i.removeChild(n),n=o,t.toPx=r})(pgAdmin, window.document);
+  (function(t, e, o) {
+    'use strict';
+
+    function r(t, e, r, p) {
+      r = r || 'width';
+      var n, l, m, c = (e.match(s) || [])[2],
+        f = 'px' === c ? 1 : d[c + 'toPx'],
+        u = /r?em/i;
+      if (f || u.test(c) && !p) t = f ? t : 'rem' === c ? i : 'fontSize' === r ? t.parentNode || t : t, f = f || parseFloat(a(t, 'fontSize')), m = parseFloat(e) * f;
+      else {
+        n = t.style, l = n[r];
+        try {
+          n[r] = e;
+        } catch (x) {
+          return 0;
+        }
+        m = n[r] ? parseFloat(a(t, r)) : 0, n[r] = l !== o ? l : null;
+      }
+      return m;
+    }
+
+    function a(t, e) {
+      var o, n, i, l, d, c = /^top|bottom/,
+        f = ['paddingTop', 'paddingBottom', 'borderTop', 'borderBottom'],
+        u = 4;
+      if (o = m ? m(t)[e] : (n = t.style['pixel' + e.charAt(0).toUpperCase() + e.slice(1)]) ? n + 'px' : 'fontSize' === e ? r(t, '1em', 'left', 1) + 'px' : t.currentStyle[e], i = (o.match(s) || [])[2], '%' === i && p)
+        if (c.test(e)) {
+          for (l = (d = t.parentNode || t).offsetHeight; u--;) l -= parseFloat(a(d, f[u]));
+          o = parseFloat(o) / 100 * l + 'px';
+        } else o = r(t, o);
+      else('auto' === o || i && 'px' !== i) && m ? o = 0 : i && 'px' !== i && !m && (o = r(t, o) + 'px');
+      return o;
+    }
+    var p, n = e.createElement('test'),
+      i = e.documentElement,
+      l = e.defaultView,
+      m = l && l.getComputedStyle,
+      s = /^(-?[\d+\.\-]+)([a-z]+|%)$/i,
+      d = {},
+      c = [1 / 25.4, 1 / 2.54, 1 / 72, 1 / 6],
+      f = ['mm', 'cm', 'pt', 'pc', 'in', 'mozmm'],
+      u = 6;
+    for (i.appendChild(n), m && (n.style.marginTop = '1%', p = '1%' === m(n).marginTop); u--;) d[f[u] + 'toPx'] = c[u] ? c[u] * d.inToPx : r(n, '1' + f[u]);
+    i.removeChild(n), n = o, t.toPx = r;
+  })(pgAdmin, window.document);
 
   // Reference:
   // https://github.com/javve/natural-sort/blob/master/index.js
   // Changed it to save the function in pgAdmin object.
   pgAdmin.natural_sort = function(a, b, options) {
+    options = options || {};
+
     var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
-        sre = /(^[ ]*|[ ]*$)/g,
-        dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
-        hre = /^0x[0-9a-f]+$/i,
-        ore = /^0/,
-        options = options || {},
-        i = function(s) { return options.insensitive && (''+s).toLowerCase() || ''+s },
-        // convert all to strings strip whitespace
-        x = i(a).replace(sre, '') || '',
-        y = i(b).replace(sre, '') || '',
-        // chunk/tokenize
-        xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
-        yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
-        // numeric, hex or date detection
-        xD = parseInt(x.match(hre)) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),
-        yD = parseInt(y.match(hre)) || xD && y.match(dre) && Date.parse(y) || null,
-        oFxNcL, oFyNcL,
-        mult = options.desc ? -1 : 1;
+      sre = /(^[ ]*|[ ]*$)/g,
+      dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
+      hre = /^0x[0-9a-f]+$/i,
+      ore = /^0/,
+      i = function(s) {
+        return options.insensitive && ('' + s).toLowerCase() || '' + s;
+      },
+      // convert all to strings strip whitespace
+      x = i(a).replace(sre, '') || '',
+      y = i(b).replace(sre, '') || '',
+      // chunk/tokenize
+      xN = x.replace(re, '\0$1\0').replace(/\0$/, '').replace(/^\0/, '').split('\0'),
+      yN = y.replace(re, '\0$1\0').replace(/\0$/, '').replace(/^\0/, '').split('\0'),
+      // numeric, hex or date detection
+      xD = parseInt(x.match(hre)) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),
+      yD = parseInt(y.match(hre)) || xD && y.match(dre) && Date.parse(y) || null,
+      oFxNcL, oFyNcL,
+      mult = options.desc ? -1 : 1;
 
     // first try and sort Hex codes or Dates
     if (yD)
-      if ( xD < yD ) return -1 * mult;
-      else if ( xD > yD ) return 1 * mult;
+      if (xD < yD) return -1 * mult;
+      else if (xD > yD) return 1 * mult;
 
     // natural sorting through split numeric strings and default strings
-    for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
+    for (var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
       // find floats not starting with '0', string or 0 if not defined (Clint Priest)
       oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
       oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
       // handle numeric vs string comparison - number < string - (Kyle Adams)
-      if (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL) ? 1 : -1) * mult; }
+      if (isNaN(oFxNcL) !== isNaN(oFyNcL)) {
+        return (isNaN(oFxNcL) ? 1 : -1) * mult;
+      }
       // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
       else if (typeof oFxNcL !== typeof oFyNcL) {
         oFxNcL += '';
@@ -64,4 +102,4 @@
   };
 
   return pgAdmin;
-}));
+});
diff --git a/web/pgadmin/static/js/size_prettify.js b/web/pgadmin/static/js/size_prettify.js
index afb50b82..b9f03f67 100644
--- a/web/pgadmin/static/js/size_prettify.js
+++ b/web/pgadmin/static/js/size_prettify.js
@@ -2,10 +2,10 @@ define([],
   function () {
     var sizePrettify = function (rawSize) {
       var size = Math.abs(rawSize),
-          limit = 10 * 1024,
-          limit2 = limit - 1,
-          cnt = 0,
-          sizeUnits = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'];
+        limit = 10 * 1024,
+        limit2 = limit - 1,
+        cnt = 0,
+        sizeUnits = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'];
 
       if (size < limit)
         return size + ' ' + sizeUnits[cnt]; // return in bytes format
@@ -20,5 +20,5 @@ define([],
       }
     };
 
-  return sizePrettify;
-});
+    return sizePrettify;
+  });
diff --git a/web/pgadmin/static/js/slickgrid/cell_selector.js b/web/pgadmin/static/js/slickgrid/cell_selector.js
index a709351e..60840a67 100644
--- a/web/pgadmin/static/js/slickgrid/cell_selector.js
+++ b/web/pgadmin/static/js/slickgrid/cell_selector.js
@@ -1,4 +1,4 @@
-define(["slickgrid"], function () {
+define(['slickgrid'], function () {
   var Slick = window.Slick;
 
   return function () {
@@ -10,9 +10,9 @@ define(["slickgrid"], function () {
             slickEvent.cell,
             slickEvent.row,
             slickEvent.cell
-          )
+          ),
         ]);
       });
-    }
-  }
+    };
+  };
 });
\ No newline at end of file
diff --git a/web/pgadmin/static/js/slickgrid/editors.js b/web/pgadmin/static/js/slickgrid/editors.js
index 518ab7f4..7652bf3b 100644
--- a/web/pgadmin/static/js/slickgrid/editors.js
+++ b/web/pgadmin/static/js/slickgrid/editors.js
@@ -4,53 +4,53 @@
  * @namespace Slick
  */
 
-(function ($) {
+(function($) {
   // register namespace
   $.extend(true, window, {
-    "Slick": {
-      "Editors": {
-        "pgText": pgTextEditor,
-        "JsonText": JsonTextEditor,
-        "CustomNumber": CustomNumberEditor,
-        "Checkbox": pgCheckboxEditor,
+    'Slick': {
+      'Editors': {
+        'pgText': pgTextEditor,
+        'JsonText': JsonTextEditor,
+        'CustomNumber': CustomNumberEditor,
+        'Checkbox': pgCheckboxEditor,
         // Below editor will read only editors, Just to display data
-        "ReadOnlyText": ReadOnlyTextEditor,
-        "ReadOnlyCheckbox": ReadOnlyCheckboxEditor,
-        "ReadOnlypgText": ReadOnlypgTextEditor,
-        "ReadOnlyJsonText": ReadOnlyJsonTextEditor
-      }
-    }
+        'ReadOnlyText': ReadOnlyTextEditor,
+        'ReadOnlyCheckbox': ReadOnlyCheckboxEditor,
+        'ReadOnlypgText': ReadOnlypgTextEditor,
+        'ReadOnlyJsonText': ReadOnlyJsonTextEditor,
+      },
+    },
   });
 
   // return wrapper element
   function getWrapper() {
-    return $("<div class='pg_text_editor' />");
+    return $('<div class=\'pg_text_editor\' />');
   }
 
   // return textarea element
   function getTextArea() {
-    return $("<textarea class='pg_textarea text-12' hidefocus rows=5'>");
+    return $('<textarea class=\'pg_textarea text-12\' hidefocus rows=5\'>');
   }
 
   // Generate and return editor buttons
   function getButtons(editable) {
-    var $buttons = $("<div class='pg_buttons' />"),
-      label = editable ? 'Cancel': 'OK',
+    var $buttons = $('<div class=\'pg_buttons\' />'),
+      label = editable ? 'Cancel' : 'OK',
       button_type = editable ? 'btn-danger' : 'btn-primary';
 
     if (editable) {
-      var $save_button = $("<button class='btn btn-primary fa fa-lg fa-save long_text_editor pg-alertify-button'>Save</button>")
-          .appendTo($buttons);
+      $('<button class=\'btn btn-primary fa fa-lg fa-save long_text_editor pg-alertify-button\'>Save</button>')
+        .appendTo($buttons);
     }
 
-    var $cancel_button = $("<button class='btn " + button_type + " fa fa-lg fa-times long_text_editor pg-alertify-button'>"+ label +"</button>")
-        .appendTo($buttons);
+    $('<button class=\'btn ' + button_type + ' fa fa-lg fa-times long_text_editor pg-alertify-button\'>' + label + '</button>')
+      .appendTo($buttons);
     return $buttons;
   }
 
   function is_valid_array(val) {
-    val = $.trim(val)
-    return !(val != "" && (val.charAt(0) != '{' || val.charAt(val.length - 1) != '}'));
+    val = $.trim(val);
+    return !(val != '' && (val.charAt(0) != '{' || val.charAt(val.length - 1) != '}'));
   }
   /*
    * This function handles the [default] and [null] values for cells
@@ -70,27 +70,29 @@
     var grid = args.grid;
     if (item.is_row_copied) {
       if (!grid.copied_rows) {
-        grid.copied_rows = [[]];
+        grid.copied_rows = [
+          [],
+        ];
       }
 
       var active_cell = grid.getActiveCell(),
-          row = active_cell['row'],
-          cell = active_cell['cell'],
-          last_value = item[args.column.pos],
-          last_value = (column_type === 'number') ?
-                        (_.isEmpty(last_value) || last_value) : last_value;
+        row = active_cell['row'],
+        cell = active_cell['cell'],
+        last_value = item[args.column.pos];
+
+      last_value = (column_type === 'number') ?
+        (_.isEmpty(last_value) || last_value) : last_value;
 
       item[args.column.field] = state;
       if (last_value && _.isNull(state) &&
-          (_.isUndefined(grid.copied_rows[row]) ||
+        (_.isUndefined(grid.copied_rows[row]) ||
           _.isUndefined(grid.copied_rows[row][cell]))
       ) {
         item[args.column.field] = undefined;
         if (grid.copied_rows[row] == undefined) grid.copied_rows[row] = [];
         grid.copied_rows[row][cell] = 1;
       }
-    }
-    else {
+    } else {
       item[args.column.field] = state;
     }
   }
@@ -100,14 +102,14 @@
     var _elem_height = $edit_grid.height(),
       is_hidden, _position;
     // We cannot display editor partially visible so we will lift it above select column
-    if(position.top > _elem_height) {
+    if (position.top > _elem_height) {
       is_hidden = position.bottom - _elem_height;
     }
 
-    if(is_hidden) {
+    if (is_hidden) {
       _position = position.top - is_hidden;
     } else {
-      _position = position.top-7;
+      _position = position.top - 7;
     }
     position.top = _position;
 
@@ -115,7 +117,7 @@
       popup_width = $wrapper.width() + 32;
     popup_width += position.left;
 
-    if(popup_width > grid_width) {
+    if (popup_width > grid_width) {
       position.left -= (popup_width - grid_width);
     }
     return position;
@@ -127,22 +129,22 @@
     var defaultValue;
     var scope = this;
 
-    this.init = function () {
-      var $container = $("body");
+    this.init = function() {
+      var $container = $('body');
 
       $wrapper = getWrapper().appendTo($container);
       $input = getTextArea().appendTo($wrapper);
       $buttons = getButtons(true).appendTo($wrapper);
 
-      $buttons.find("button:first").on("click", this.save);
-      $buttons.find("button:last").on("click", this.cancel);
-      $input.bind("keydown", this.handleKeyDown);
+      $buttons.find('button:first').on('click', this.save);
+      $buttons.find('button:last').on('click', this.cancel);
+      $input.bind('keydown', this.handleKeyDown);
 
       scope.position(args.position);
       $input.focus().select();
     };
 
-    this.handleKeyDown = function (e) {
+    this.handleKeyDown = function(e) {
       if (e.which == $.ui.keyCode.ENTER && e.ctrlKey) {
         scope.save();
       } else if (e.which == $.ui.keyCode.ESCAPE) {
@@ -157,52 +159,53 @@
       }
     };
 
-    this.save = function () {
+    this.save = function() {
       args.commitChanges();
     };
 
-    this.cancel = function () {
+    this.cancel = function() {
       $input.val(defaultValue);
       args.cancelChanges();
     };
 
-    this.hide = function () {
+    this.hide = function() {
       $wrapper.hide();
     };
 
-    this.show = function () {
+    this.show = function() {
       $wrapper.show();
     };
 
-    this.position = function (position) {
+    this.position = function(position) {
       calculateEditorPosition(position, $wrapper);
       $wrapper
-        .css("top", position.top)
-        .css("left", position.left)
-    }
+        .css('top', position.top)
+        .css('left', position.left);
+    };
 
-    this.destroy = function () {
+    this.destroy = function() {
       $wrapper.remove();
     };
 
-    this.focus = function () {
+    this.focus = function() {
       $input.focus();
     };
 
     // When text editor opens
-    this.loadValue = function (item) {
-      var col = args.column;
-
-      if (_.isUndefined(item[args.column.field]) || _.isNull(item[args.column.field])) {
-          $input.val(defaultValue = "");
-          return;
+    this.loadValue = function(item) {
+      if (
+        _.isUndefined(item[args.column.field]) ||
+        _.isNull(item[args.column.field])
+      ) {
+        $input.val(defaultValue = '');
+        return;
       }
 
       if (!args.column.is_array) {
-        if (item[args.column.field] === "") {
-          $input.val(defaultValue = "''");
-        } else if (item[args.column.field] === "''") {
-          $input.val(defaultValue = "\\'\\'");
+        if (item[args.column.field] === '') {
+          $input.val(defaultValue = '\'\'');
+        } else if (item[args.column.field] === '\'\'') {
+          $input.val(defaultValue = '\\\'\\\'');
         } else if (item[args.column.field] === '""') {
           $input.val(defaultValue = '\\"\\"');
         } else {
@@ -215,19 +218,19 @@
       }
     };
 
-    this.serializeValue = function () {
+    this.serializeValue = function() {
 
       var value = $input.val();
       // If empty return null
-      if (value === "") {
+      if (value === '') {
         return null;
       }
 
       if (!args.column.is_array) {
-        if (value === "''" || value === '""') {
+        if (value === '\'\'' || value === '""') {
           return '';
-        } else if (value === "\\'\\'") {
-          return "''";
+        } else if (value === '\\\'\\\'') {
+          return '\'\'';
         } else if (value === '\\"\\"') {
           return '""';
         } else {
@@ -238,22 +241,22 @@
       }
     };
 
-    this.applyValue = function (item, state) {
+    this.applyValue = function(item, state) {
       setValue(args, item, state, 'text');
     };
 
-    this.isValueChanged = function () {
+    this.isValueChanged = function() {
       // Use _.isNull(value) for comparison for null instead of
       // defaultValue == null, because it returns true for undefined value.
-      if ($input.val() == "" && _.isUndefined(defaultValue)) {
+      if ($input.val() == '' && _.isUndefined(defaultValue)) {
         return false;
       } else {
-        return (!($input.val() == "" && _.isNull(defaultValue))) &&
-               ($input.val() !== defaultValue);
+        return (!($input.val() == '' && _.isNull(defaultValue))) &&
+          ($input.val() !== defaultValue);
       }
     };
 
-    this.validate = function () {
+    this.validate = function() {
       if (args.column.validator) {
         var validationResults = args.column.validator($input.val());
         if (!validationResults.valid) {
@@ -264,13 +267,13 @@
       if (args.column.is_array && !is_valid_array($input.val())) {
         return {
           valid: false,
-          msg: "Array must start with '{' and end with '}'"
+          msg: 'Array must start with \'{\' and end with \'}\'',
         };
       }
 
       return {
         valid: true,
-        msg: null
+        msg: null,
       };
     };
 
@@ -283,22 +286,22 @@
     var defaultValue;
     var scope = this;
 
-    this.init = function () {
-      var $container = $("body");
+    this.init = function() {
+      var $container = $('body');
 
       $wrapper = getWrapper().appendTo($container);
       $input = getTextArea().appendTo($wrapper);
       $buttons = getButtons(true).appendTo($wrapper);
 
-      $buttons.find("button:first").on("click", this.save);
-      $buttons.find("button:last").on("click", this.cancel);
-      $input.bind("keydown", this.handleKeyDown);
+      $buttons.find('button:first').on('click', this.save);
+      $buttons.find('button:last').on('click', this.cancel);
+      $input.bind('keydown', this.handleKeyDown);
 
       scope.position(args.position);
       $input.focus().select();
     };
 
-    this.handleKeyDown = function (e) {
+    this.handleKeyDown = function(e) {
       if (e.which == $.ui.keyCode.ENTER && e.ctrlKey) {
         scope.save();
       } else if (e.which == $.ui.keyCode.ESCAPE) {
@@ -313,77 +316,77 @@
       }
     };
 
-    this.save = function () {
+    this.save = function() {
       args.commitChanges();
     };
 
-    this.cancel = function () {
+    this.cancel = function() {
       $input.val(defaultValue);
       args.cancelChanges();
     };
 
-    this.hide = function () {
+    this.hide = function() {
       $wrapper.hide();
     };
 
-    this.show = function () {
+    this.show = function() {
       $wrapper.show();
     };
 
-    this.position = function (position) {
+    this.position = function(position) {
       calculateEditorPosition(position, $wrapper);
       $wrapper
-        .css("top", position.top)
-        .css("left", position.left)
-    }
+        .css('top', position.top)
+        .css('left', position.left);
+    };
 
-    this.destroy = function () {
+    this.destroy = function() {
       $wrapper.remove();
     };
 
-    this.focus = function () {
+    this.focus = function() {
       $input.focus();
     };
 
-    this.loadValue = function (item) {
+    this.loadValue = function(item) {
       var data = defaultValue = item[args.column.field];
-      if (data && typeof data === "object" && !Array.isArray(data)) {
+      if (data && typeof data === 'object' && !Array.isArray(data)) {
         data = JSON.stringify(data, null, 4);
       } else if (Array.isArray(data)) {
         var temp = [];
         $.each(data, function(i, val) {
-          if (typeof val === "object") {
+          if (typeof val === 'object') {
             temp.push(JSON.stringify(val, null, 4));
           } else {
-            temp.push(val)
+            temp.push(val);
           }
         });
-        data = "[" + temp.join() + "]";
+        data = '[' + temp.join() + ']';
       }
       $input.val(data);
       $input.select();
     };
 
-    this.serializeValue = function () {
-      if ($input.val() === "") {
+    this.serializeValue = function() {
+      if ($input.val() === '') {
         return null;
       }
       return $input.val();
     };
 
-    this.applyValue = function (item, state) {
+    this.applyValue = function(item, state) {
       setValue(args, item, state, 'text');
     };
 
-    this.isValueChanged = function () {
-      if ($input.val() == "" && _.isUndefined(defaultValue)) {
+    this.isValueChanged = function() {
+      if ($input.val() == '' && _.isUndefined(defaultValue)) {
         return false;
       } else {
-        return (!($input.val() == "" && _.isNull(defaultValue))) && ($input.val() != defaultValue);
+        return (!($input.val() == '' && _.isNull(defaultValue))) && ($input.val() != defaultValue);
       }
     };
 
-    this.validate = function () {
+    this.validate = function() {
       if (args.column.validator) {
         var validationResults = args.column.validator($input.val());
         if (!validationResults.valid) {
@@ -393,7 +396,7 @@
 
       return {
         valid: true,
-        msg: null
+        msg: null,
       };
     };
 
@@ -406,21 +409,21 @@
     var defaultValue;
     var scope = this;
 
-    this.init = function () {
-      var $container = $("body");
+    this.init = function() {
+      var $container = $('body');
 
       $wrapper = getWrapper().appendTo($container);
       $input = getTextArea().appendTo($wrapper);
       $buttons = getButtons(false).appendTo($wrapper);
 
-      $buttons.find("button:first").on("click", this.cancel);
-      $input.bind("keydown", this.handleKeyDown);
+      $buttons.find('button:first').on('click', this.cancel);
+      $input.bind('keydown', this.handleKeyDown);
 
       scope.position(args.position);
       $input.focus().select();
     };
 
-    this.handleKeyDown = function (e) {
+    this.handleKeyDown = function(e) {
       if (e.which == $.ui.keyCode.ENTER && e.ctrlKey) {
         scope.cancel();
       } else if (e.which == $.ui.keyCode.ESCAPE) {
@@ -437,52 +440,52 @@
       }
     };
 
-    this.cancel = function () {
+    this.cancel = function() {
       $input.val(defaultValue);
       args.cancelChanges();
     };
 
-    this.hide = function () {
+    this.hide = function() {
       $wrapper.hide();
     };
 
-    this.show = function () {
+    this.show = function() {
       $wrapper.show();
     };
 
-    this.position = function (position) {
+    this.position = function(position) {
       calculateEditorPosition(position, $wrapper);
       $wrapper
-        .css("top", position.top)
-        .css("left", position.left)
-    }
+        .css('top', position.top)
+        .css('left', position.left);
+    };
 
-    this.destroy = function () {
+    this.destroy = function() {
       $wrapper.remove();
     };
 
-    this.focus = function () {
+    this.focus = function() {
       $input.focus();
     };
 
-    this.loadValue = function (item) {
+    this.loadValue = function(item) {
       $input.val(defaultValue = item[args.column.field]);
       $input.select();
     };
 
-    this.serializeValue = function () {
+    this.serializeValue = function() {
       return $input.val();
     };
 
-    this.applyValue = function (item, state) {
+    this.applyValue = function(item, state) {
       item[args.column.field] = state;
     };
 
-    this.isValueChanged = function () {
-      return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue);
+    this.isValueChanged = function() {
+      return (!($input.val() == '' && defaultValue == null)) && ($input.val() != defaultValue);
     };
 
-    this.validate = function () {
+    this.validate = function() {
       if (args.column.validator) {
         var validationResults = args.column.validator($input.val());
         if (!validationResults.valid) {
@@ -492,123 +495,7 @@
 
       return {
         valid: true,
-        msg: null
-      };
-    };
-
-    this.init();
-  }
-
-  /* Override CheckboxEditor to implement checkbox with three states.
-   * 1) checked=true
-   * 2) unchecked=false
-   * 3) indeterminate=null
-   */
-  function CheckboxEditor(args) {
-    var $select, el;
-    var defaultValue, previousState;
-    var scope = this;
-
-    this.init = function () {
-      $select = $("<input type=checkbox class='editor-checkbox' hideFocus>");
-      $select.appendTo(args.container);
-      $select.focus();
-
-      // The following code is taken from https://css-tricks.com/indeterminate-checkboxes/
-      $select.bind("click", function (e) {
-        el = $(this);
-        el.prop('indeterminate', false);
-
-        var checkbox_status = el.data('checked');
-        // add new row > checkbox clicked
-        if (el.data('checked') == undefined) {
-          checkbox_status = 1;
-        }
-        switch(checkbox_status) {
-          // State 0 will come when we had indeterminate state
-          case 0:
-            // We will check now
-            el.prop('checked', true);
-            el.data('checked', 1);
-            break;
-
-          // State 1 will come when we had checked state
-          case 1:
-            // We will uncheck now
-            el.prop('checked', false);
-            el.data('checked', 2);
-            break;
-
-          // State 2 will come when we had unchecked state
-          case 2:
-            // We will set to indeterminate state
-            el.prop('indeterminate', true);
-            el.data('checked', 0);
-            break;
-
-          // Default, Set to indeterminate state
-          default:
-            el.prop('indeterminate', true);
-            el.data('checked', 0);
-        }
-      });
-    };
-
-    this.destroy = function () {
-      $select.remove();
-    };
-
-    this.focus = function () {
-      $select.focus();
-    };
-
-    this.loadValue = function (item) {
-      defaultValue = item[args.column.field];
-      previousState = 0;
-      if (_.isNull(defaultValue)||_.isUndefined(defaultValue)) {
-        $select.prop('indeterminate', true);
-        $select.data('checked', 0);
-      }
-      else {
-        defaultValue = !!item[args.column.field];
-        if (defaultValue) {
-          $select.prop('checked', true);
-          $select.data('checked', 1);
-          previousState = 1;
-        } else {
-          $select.prop('checked', false);
-          $select.data('checked', 2);
-          previousState = 2;
-        }
-      }
-    };
-
-    this.serializeValue = function () {
-      if ($select.prop('indeterminate')) {
-        return null;
-      }
-      return $select.prop('checked');
-    };
-
-    this.applyValue = function (item, state) {
-      item[args.column.field] = state;
-    };
-
-    this.isValueChanged = function () {
-      var currentState = $select.data('checked');
-      return currentState !== previousState;
-    };
-
-    this.validate = function () {
-      if (args.column.validator) {
-        var validationResults = args.column.validator(this.serializeValue());
-        if (!validationResults.valid) {
-          return validationResults;
-        }
-      }
-      return {
-        valid: true,
-        msg: null
+        msg: null,
       };
     };
 
@@ -621,21 +508,21 @@
     var defaultValue;
     var scope = this;
 
-    this.init = function () {
-      var $container = $("body");
+    this.init = function() {
+      var $container = $('body');
 
       $wrapper = getWrapper().appendTo($container);
       $input = getTextArea().appendTo($wrapper);
       $buttons = getButtons(false).appendTo($wrapper);
 
-      $buttons.find("button:first").on("click", this.cancel);
-      $input.bind("keydown", this.handleKeyDown);
+      $buttons.find('button:first').on('click', this.cancel);
+      $input.bind('keydown', this.handleKeyDown);
 
       scope.position(args.position);
       $input.focus().select();
     };
 
-    this.handleKeyDown = function (e) {
+    this.handleKeyDown = function(e) {
       if (e.which == $.ui.keyCode.ENTER && e.ctrlKey) {
         scope.cancel();
       } else if (e.which == $.ui.keyCode.ESCAPE) {
@@ -652,66 +539,66 @@
       }
     };
 
-    this.cancel = function () {
+    this.cancel = function() {
       $input.val(defaultValue);
       args.cancelChanges();
     };
 
-    this.hide = function () {
+    this.hide = function() {
       $wrapper.hide();
     };
 
-    this.show = function () {
+    this.show = function() {
       $wrapper.show();
     };
 
-    this.position = function (position) {
+    this.position = function(position) {
       calculateEditorPosition(position, $wrapper);
       $wrapper
-        .css("top", position.top)
-        .css("left", position.left)
-    }
+        .css('top', position.top)
+        .css('left', position.left);
+    };
 
-    this.destroy = function () {
+    this.destroy = function() {
       $wrapper.remove();
     };
 
-    this.focus = function () {
+    this.focus = function() {
       $input.focus();
     };
 
-    this.loadValue = function (item) {
+    this.loadValue = function(item) {
       var data = defaultValue = item[args.column.field];
-      if (typeof data === "object" && !Array.isArray(data)) {
+      if (typeof data === 'object' && !Array.isArray(data)) {
         data = JSON.stringify(data, null, 4);
       } else if (Array.isArray(data)) {
         var temp = [];
         $.each(data, function(i, val) {
-          if (typeof val === "object") {
+          if (typeof val === 'object') {
             temp.push(JSON.stringify(val, null, 4));
           } else {
-            temp.push(val)
+            temp.push(val);
           }
         });
-        data = "[" + temp.join() + "]";
+        data = '[' + temp.join() + ']';
       }
       $input.val(data);
       $input.select();
     };
 
-    this.serializeValue = function () {
+    this.serializeValue = function() {
       return $input.val();
     };
 
-    this.applyValue = function (item, state) {
+    this.applyValue = function(item, state) {
       item[args.column.field] = state;
     };
 
-    this.isValueChanged = function () {
-      return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue);
+    this.isValueChanged = function() {
+      return (!($input.val() == '' && defaultValue == null)) && ($input.val() != defaultValue);
     };
 
-    this.validate = function () {
+    this.validate = function() {
       if (args.column.validator) {
         var validationResults = args.column.validator($input.val());
         if (!validationResults.valid) {
@@ -721,7 +608,7 @@
 
       return {
         valid: true,
-        msg: null
+        msg: null,
       };
     };
 
@@ -731,38 +618,37 @@
   function ReadOnlyTextEditor(args) {
     var $input;
     var defaultValue;
-    var scope = this;
 
-    this.init = function () {
-      $input = $("<INPUT type=text class='editor-text' readonly/>")
-          .appendTo(args.container)
-          .bind("keydown.nav", function (e) {
-            if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) {
-              e.stopImmediatePropagation();
-            }
-          })
-          .focus()
-          .select();
+    this.init = function() {
+      $input = $('<INPUT type=text class=\'editor-text\' readonly/>')
+        .appendTo(args.container)
+        .bind('keydown.nav', function(e) {
+          if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) {
+            e.stopImmediatePropagation();
+          }
+        })
+        .focus()
+        .select();
     };
 
-    this.destroy = function () {
+    this.destroy = function() {
       $input.remove();
     };
 
-    this.focus = function () {
+    this.focus = function() {
       $input.focus();
     };
 
-    this.getValue = function () {
+    this.getValue = function() {
       return $input.val();
     };
 
-    this.loadValue = function (item) {
+    this.loadValue = function(item) {
       var value = item[args.column.field];
 
       // Check if value is null or undefined
-      if (value === undefined && typeof value === "undefined") {
-        value = ""
+      if (value === undefined && typeof value === 'undefined') {
+        value = '';
       }
       defaultValue = value;
       $input.val(defaultValue);
@@ -770,19 +656,19 @@
       $input.select();
     };
 
-    this.serializeValue = function () {
+    this.serializeValue = function() {
       return $input.val();
     };
 
-    this.applyValue = function (item, state) {
+    this.applyValue = function(item, state) {
       item[args.column.field] = state;
     };
 
-    this.isValueChanged = function () {
-      return (!($input.val() == "" && defaultValue == null)) && ($input.val() != defaultValue);
+    this.isValueChanged = function() {
+      return (!($input.val() == '' && defaultValue == null)) && ($input.val() != defaultValue);
     };
 
-    this.validate = function () {
+    this.validate = function() {
       if (args.column.validator) {
         var validationResults = args.column.validator($input.val());
         if (!validationResults.valid) {
@@ -792,7 +678,7 @@
 
       return {
         valid: true,
-        msg: null
+        msg: null,
       };
     };
 
@@ -800,31 +686,29 @@
   }
 
   function ReadOnlyCheckboxEditor(args) {
-    var $select, el;
+    var $select;
     var defaultValue;
-    var scope = this;
 
-    this.init = function () {
-      $select = $("<INPUT type=checkbox value='true' class='editor-checkbox' hideFocus disabled>");
+    this.init = function() {
+      $select = $('<INPUT type=checkbox value=\'true\' class=\'editor-checkbox\' hideFocus disabled>');
       $select.appendTo(args.container);
       $select.focus();
     };
 
-    this.destroy = function () {
+    this.destroy = function() {
       $select.remove();
     };
 
-    this.focus = function () {
+    this.focus = function() {
       $select.focus();
     };
 
-    this.loadValue = function (item) {
+    this.loadValue = function(item) {
       defaultValue = item[args.column.pos];
-      if (_.isNull(defaultValue)|| _.isUndefined(defaultValue)) {
+      if (_.isNull(defaultValue) || _.isUndefined(defaultValue)) {
         $select.prop('indeterminate', true);
         $select.data('checked', 2);
-      }
-      else {
+      } else {
         defaultValue = !!item[args.column.pos];
         if (defaultValue) {
           $select.prop('checked', true);
@@ -836,28 +720,28 @@
       }
     };
 
-    this.serializeValue = function () {
+    this.serializeValue = function() {
       if ($select.prop('indeterminate')) {
         return null;
       }
       return $select.prop('checked');
     };
 
-    this.applyValue = function (item, state) {
+    this.applyValue = function(item, state) {
       item[args.column.pos] = state;
     };
 
-    this.isValueChanged = function () {
+    this.isValueChanged = function() {
       // var select_value = this.serializeValue();
       var select_value = $select.data('checked');
       return (!(select_value === 2 && (defaultValue == null || defaultValue == undefined))) &&
-            (select_value !== defaultValue);
+        (select_value !== defaultValue);
     };
 
-    this.validate = function () {
+    this.validate = function() {
       return {
         valid: true,
-        msg: null
+        msg: null,
       };
     };
 
@@ -867,12 +751,11 @@
   function CustomNumberEditor(args) {
     var $input;
     var defaultValue;
-    var scope = this;
 
-    this.init = function () {
-      $input = $("<INPUT type=text class='editor-text' />");
+    this.init = function() {
+      $input = $('<INPUT type=text class=\'editor-text\' />');
 
-      $input.bind("keydown.nav", function (e) {
+      $input.bind('keydown.nav', function(e) {
         if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) {
           e.stopImmediatePropagation();
         }
@@ -882,19 +765,19 @@
       $input.focus().select();
     };
 
-    this.destroy = function () {
+    this.destroy = function() {
       $input.remove();
     };
 
-    this.focus = function () {
+    this.focus = function() {
       $input.focus();
     };
 
-    this.loadValue = function (item) {
+    this.loadValue = function(item) {
       defaultValue = item[args.column.field];
 
-      if(args.column.is_array && !_.isNull(defaultValue) && !_.isUndefined(defaultValue)) {
-        $input.val('{' + defaultValue.join() +'}');
+      if (args.column.is_array && !_.isNull(defaultValue) && !_.isUndefined(defaultValue)) {
+        $input.val('{' + defaultValue.join() + '}');
       } else {
         $input.val(defaultValue);
       }
@@ -903,25 +786,25 @@
       $input.select();
     };
 
-    this.serializeValue = function () {
+    this.serializeValue = function() {
       var value = $input.val();
 
-      if (value === "") {
+      if (value === '') {
         return null;
       }
 
-      if(args.column.is_array) {
+      if (args.column.is_array) {
         // Remove leading { and trailing }.
         // Also remove leading and trailing whitespaces.
         var val = $.trim(value.slice(1, -1));
 
-        if(val == '') {
+        if (val == '') {
           return [];
         }
         val = val.split(',');
         for (var k in val) {
-          if (val[k] == "") {
-            val[k] = null;  //empty string from editor is null value.
+          if (val[k] == '') {
+            val[k] = null; //empty string from editor is null value.
           }
         }
         return val;
@@ -930,27 +813,27 @@
       return value;
     };
 
-    this.applyValue = function (item, state) {
+    this.applyValue = function(item, state) {
       setValue(args, item, state, 'number');
     };
 
-    this.isValueChanged = function () {
-      if ($input.val() == "" && _.isUndefined(defaultValue)) {
+    this.isValueChanged = function() {
+      if ($input.val() == '' && _.isUndefined(defaultValue)) {
         return false;
-      } else if ($input.val() == "" && defaultValue == "") {
+      } else if ($input.val() == '' && defaultValue == '') {
         return true;
       } else {
-        return (!($input.val() == "" && _.isNull(defaultValue ))) &&
-        ($input.val() != defaultValue);
+        return (!($input.val() == '' && _.isNull(defaultValue))) &&
+          ($input.val() != defaultValue);
       }
     };
 
-    this.validate = function () {
+    this.validate = function() {
       var value = $input.val();
       if (!args.column.is_array && isNaN(value)) {
         return {
           valid: false,
-          msg: "Please enter a valid number"
+          msg: 'Please enter a valid number',
         };
       }
       if (args.column.validator) {
@@ -964,24 +847,24 @@
         if (!is_valid_array(value)) {
           return {
             valid: false,
-            msg: "Array must start with '{' and end with '}'"
+            msg: 'Array must start with \'{\' and end with \'}\'',
           };
         }
 
         var val = $.trim(value.slice(1, -1)),
-            arr;
+          arr;
 
-        if(val == '') {
+        if (val == '') {
           arr = [];
         } else {
-          var arr = val.split(',');
+          arr = val.split(',');
         }
 
         for (var k in arr) {
           if (isNaN(arr[k])) {
             return {
               valid: false,
-              msg: "Please enter a valid numbers"
+              msg: 'Please enter a valid numbers',
             };
           }
         }
@@ -989,7 +872,7 @@
 
       return {
         valid: true,
-        msg: null
+        msg: null,
       };
     };
 
@@ -1001,69 +884,67 @@
   function pgCheckboxEditor(args) {
     var $select, el;
     var defaultValue, previousState;
-    var scope = this;
 
-    this.init = function () {
-      $select = $("<div class='multi-checkbox'><span class='check' hideFocus></span></div>");
+    this.init = function() {
+      $select = $('<div class=\'multi-checkbox\'><span class=\'check\' hideFocus></span></div>');
       $select.appendTo(args.container);
       $select.focus();
 
       // The following code is taken from https://css-tricks.com/indeterminate-checkboxes/
-      $select.bind("click", function (e) {
+      $select.bind('click', function() {
         el = $(this);
-        var states = ["unchecked", "partial", "checked"];
-        var curState = el.find(".check").data("state");
+        var states = ['unchecked', 'partial', 'checked'];
+        var curState = el.find('.check').data('state');
         curState++;
-        el.find(".check")
-          .removeClass("unchecked partial checked")
+        el.find('.check')
+          .removeClass('unchecked partial checked')
           .addClass(states[curState % states.length])
-          .data("state", curState % states.length);
+          .data('state', curState % states.length);
       });
     };
 
-    this.destroy = function () {
+    this.destroy = function() {
       $select.remove();
     };
 
-    this.focus = function () {
+    this.focus = function() {
       $select.focus();
     };
 
-    this.loadValue = function (item) {
+    this.loadValue = function(item) {
       defaultValue = item[args.column.field];
       previousState = 1;
-      if (_.isNull(defaultValue)||_.isUndefined(defaultValue)) {
-        $select.find(".check").data("state", 1).addClass("partial");
-      }
-      else {
+      if (_.isNull(defaultValue) || _.isUndefined(defaultValue)) {
+        $select.find('.check').data('state', 1).addClass('partial');
+      } else {
         defaultValue = !!item[args.column.field];
         if (defaultValue) {
-          $select.find(".check").data("state", 2).addClass("checked");
+          $select.find('.check').data('state', 2).addClass('checked');
           previousState = 2;
         } else {
-          $select.find(".check").data("state", 0).addClass("unchecked");
+          $select.find('.check').data('state', 0).addClass('unchecked');
           previousState = 0;
         }
       }
     };
 
-    this.serializeValue = function () {
-      if ($select.find(".check").data("state") == 1) {
+    this.serializeValue = function() {
+      if ($select.find('.check').data('state') == 1) {
         return null;
       }
-      return $select.find(".check").data("state") == 2 ? true : false;
+      return $select.find('.check').data('state') == 2 ? true : false;
     };
 
-    this.applyValue = function (item, state) {
+    this.applyValue = function(item, state) {
       item[args.column.field] = state;
     };
 
-    this.isValueChanged = function () {
-      var currentState = $select.find(".check").data("state");
+    this.isValueChanged = function() {
+      var currentState = $select.find('.check').data('state');
       return currentState !== previousState;
     };
 
-    this.validate = function () {
+    this.validate = function() {
       if (args.column.validator) {
         var validationResults = args.column.validator(this.serializeValue());
         if (!validationResults.valid) {
@@ -1072,11 +953,11 @@
       }
       return {
         valid: true,
-        msg: null
+        msg: null,
       };
     };
 
     this.init();
   }
 
-})(jQuery);
+})(window.jQuery);
diff --git a/web/pgadmin/static/js/slickgrid/event_handlers/handle_query_output_keyboard_event.js b/web/pgadmin/static/js/slickgrid/event_handlers/handle_query_output_keyboard_event.js
index eb765131..a8685bc3 100644
--- a/web/pgadmin/static/js/slickgrid/event_handlers/handle_query_output_keyboard_event.js
+++ b/web/pgadmin/static/js/slickgrid/event_handlers/handle_query_output_keyboard_event.js
@@ -1,7 +1,7 @@
 define([
   'sources/selection/copy_data',
-  'sources/selection/range_selection_helper'
-  ],
+  'sources/selection/range_selection_helper',
+],
 function (copyData, RangeSelectionHelper) {
   return function handleQueryOutputKeyboardEvent(event, args) {
     var KEY_C = 67;
@@ -10,7 +10,7 @@ function (copyData, RangeSelectionHelper) {
     var isModifierDown = event.ctrlKey || event.metaKey;
     var self = this || window;
     self.slickgrid = args.grid;
-    self.csvOptions
+    self.csvOptions;
 
     if (isModifierDown && modifiedKey == KEY_C) {
       copyData.apply(self);
@@ -19,5 +19,5 @@ function (copyData, RangeSelectionHelper) {
     if (isModifierDown && modifiedKey == KEY_A) {
       RangeSelectionHelper.selectAll(self.slickgrid);
     }
-  }
+  };
 });
diff --git a/web/pgadmin/static/js/slickgrid/formatters.js b/web/pgadmin/static/js/slickgrid/formatters.js
index 31dbbac7..adfcf791 100644
--- a/web/pgadmin/static/js/slickgrid/formatters.js
+++ b/web/pgadmin/static/js/slickgrid/formatters.js
@@ -5,42 +5,40 @@
  * @namespace Slick
  */
 
-(function ($) {
+(function($) {
   // register namespace
   $.extend(true, window, {
-    "Slick": {
-      "Formatters": {
-        "JsonString": JsonFormatter,
-        "Numbers": NumbersFormatter,
-        "Checkmark": CheckmarkFormatter,
-        "Text": TextFormatter,
-        "Binary": BinaryFormatter,
-      }
-    }
+    'Slick': {
+      'Formatters': {
+        'JsonString': JsonFormatter,
+        'Numbers': NumbersFormatter,
+        'Checkmark': CheckmarkFormatter,
+        'Text': TextFormatter,
+        'Binary': BinaryFormatter,
+      },
+    },
   });
 
-  function NullAndDefaultFormatter(row, cell, value, columnDef, dataContext) {
+  function NullAndDefaultFormatter(row, cell, value, columnDef) {
     if (_.isUndefined(value) && columnDef.has_default_val) {
-        return "<span class='pull-left disabled_cell'>[default]</span>";
-    }
-    else if (
+      return '<span class=\'pull-left disabled_cell\'>[default]</span>';
+    } else if (
       (_.isUndefined(value) && columnDef.not_null) ||
       (_.isUndefined(value) || value === null)
     ) {
-      return "<span class='pull-left disabled_cell'>[null]</span>";
+      return '<span class=\'pull-left disabled_cell\'>[null]</span>';
     }
     return null;
   }
 
-  function NullAndDefaultNumberFormatter(row, cell, value, columnDef, dataContext) {
+  function NullAndDefaultNumberFormatter(row, cell, value, columnDef) {
     if (_.isUndefined(value) && columnDef.has_default_val) {
-        return "<span class='pull-right disabled_cell'>[default]</span>";
-    }
-    else if (
+      return '<span class=\'pull-right disabled_cell\'>[default]</span>';
+    } else if (
       (_.isUndefined(value) && columnDef.not_null) ||
       (_.isUndefined(value) || value === null)
     ) {
-      return "<span class='pull-right disabled_cell'>[null]</span>";
+      return '<span class=\'pull-right disabled_cell\'>[null]</span>';
     }
     return null;
   }
@@ -52,18 +50,18 @@
       return data;
     } else {
       // Stringify only if it's json object
-      if (typeof value === "object" && !Array.isArray(value)) {
+      if (typeof value === 'object' && !Array.isArray(value)) {
         return _.escape(JSON.stringify(value));
       } else if (Array.isArray(value)) {
         var temp = [];
         $.each(value, function(i, val) {
-          if (typeof val === "object") {
+          if (typeof val === 'object') {
             temp.push(JSON.stringify(val));
           } else {
-            temp.push(val)
+            temp.push(val);
           }
         });
-        return _.escape("[" + temp.join() + "]")
+        return _.escape('[' + temp.join() + ']');
       } else {
         return _.escape(value);
       }
@@ -76,7 +74,7 @@
     if (data) {
       return data;
     } else {
-      return "<span style='float:right'>" + _.escape(value) + "</span>";
+      return '<span style=\'float:right\'>' + _.escape(value) + '</span>';
     }
   }
 
@@ -90,7 +88,7 @@
     if (data) {
       return data;
     } else {
-      return value ? "true" : "false";
+      return value ? 'true' : 'false';
     }
   }
 
@@ -110,7 +108,7 @@
     if (data) {
       return data;
     } else {
-      return "<span class='pull-left disabled_cell'>[" + _.escape(value) + "]</span>";
+      return '<span class=\'pull-left disabled_cell\'>[' + _.escape(value) + ']</span>';
     }
   }
-})(jQuery);
+})(window.jQuery);
diff --git a/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js b/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js
index 9e593a2f..2ad47557 100644
--- a/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js
+++ b/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js
@@ -77,5 +77,5 @@ module.exports = {
   isKeyCtrlAlt: isKeyCtrlAlt,
   isKeyAltShift: isKeyAltShift,
   isKeyCtrlShift: isKeyCtrlShift,
-  isKeyCtrlAltShift: isKeyCtrlAltShift
+  isKeyCtrlAltShift: isKeyCtrlAltShift,
 };
diff --git a/web/pgadmin/static/js/sqleditor_utils.js b/web/pgadmin/static/js/sqleditor_utils.js
index ea775a50..21d31856 100644
--- a/web/pgadmin/static/js/sqleditor_utils.js
+++ b/web/pgadmin/static/js/sqleditor_utils.js
@@ -16,19 +16,19 @@ define(['jquery'],
        */
       epicRandomString: function(length) {
         var s = [];
-        var hexDigits = "0123456789abcdef";
+        var hexDigits = '0123456789abcdef';
         for (var i = 0; i < 36; i++) {
-            s[i] = hexDigits.substr(
+          s[i] = hexDigits.substr(
                     Math.floor(Math.random() * 0x10), 1
                   );
         }
         // bits 12-15 of the time_hi_and_version field to 0010
-        s[14] = "4";
+        s[14] = '4';
         // bits 6-7 of the clock_seq_hi_and_reserved to 01
         s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
-        s[8] = s[13] = s[18] = s[23] = "-";
+        s[8] = s[13] = s[18] = s[23] = '-';
 
-        var uuid = s.join("");
+        var uuid = s.join('');
         return uuid.replace(/-/g, '').substr(0, length);
       },
 
@@ -55,7 +55,7 @@ define(['jquery'],
       },
       capitalizeFirstLetter: function (string) {
         return string.charAt(0).toUpperCase() + string.slice(1);
-      }
+      },
     };
     return sqlEditorUtils;
-});
+  });
diff --git a/web/pgadmin/static/js/url_for.js b/web/pgadmin/static/js/url_for.js
index b1005381..5133fceb 100644
--- a/web/pgadmin/static/js/url_for.js
+++ b/web/pgadmin/static/js/url_for.js
@@ -1,4 +1,4 @@
-define(["pgadmin.browser.endpoints"], function (endpoints) {
+define(['pgadmin.browser.endpoints'], function(endpoints) {
   /***
    * This method behaves as a drop-in replacement for flask url_for function.
    * It uses the exposed URLs file under the hood, and replace the substitions provided by the modules.
@@ -16,17 +16,15 @@ define(["pgadmin.browser.endpoints"], function (endpoints) {
     var rawURL = endpoints[endpoint];
 
     // captures things of the form <path:substitutionName>
-    var substitutionGroupsRegExp = /([<])([^:^>]*:)?([^>]+)([>])/g;
-    var matchFound;
-
-    var interpolated = rawURL;
+    var substitutionGroupsRegExp = /([<])([^:^>]*:)?([^>]+)([>])/g,
+      interpolated = rawURL;
 
     if (!rawURL)
       return rawURL;
 
     interpolated = interpolated.replace(
       substitutionGroupsRegExp,
-      function (_origin, _1, _2, substitutionName) {
+      function(_origin, _1, _2, substitutionName) {
         if (substitutionName in substitutions) {
           return substitutions[substitutionName];
         }
