diff --git a/web/pgadmin/static/vendor/backgrid/backgrid-select-all.js b/web/pgadmin/static/vendor/backgrid/backgrid-select-all.js
index 6f3d2db52..e9bcf5130 100644
--- a/web/pgadmin/static/vendor/backgrid/backgrid-select-all.js
+++ b/web/pgadmin/static/vendor/backgrid/backgrid-select-all.js
@@ -103,7 +103,9 @@
                command.moveUp() || command.moveDown()) {
         e.preventDefault();
         e.stopPropagation();
-        this.model.trigger("backgrid:edited", this.model, this.column, command);
+        if(this.model) {
+          this.model.trigger("backgrid:edited", this.model, this.column, command);
+        }
       }
     },
 
@@ -122,15 +124,15 @@
        Renders a checkbox in a table cell.
     */
     render: function () {
-      let id = `selectall-${_.uniqueId(this.column.get('name'))}`;
-      this.$el.empty().append(`
-        <div class="custom-control custom-checkbox custom-checkbox-no-label">
-          <input tabindex="-1" type="checkbox" class="custom-control-input" id="${id}" />
-          <label class="custom-control-label" for="${id}">
-            <span class="sr-only">Select All<span>
-          </label>
-        </div>
-      `);
+      var id = 'selectall-' + _.uniqueId(this.column.get('name'));
+      this.$el.empty().append([
+        '<div class="custom-control custom-checkbox custom-checkbox-no-label">',
+        '  <input tabindex="-1" type="checkbox" class="custom-control-input" id="'+ id +'" />',
+        '  <label class="custom-control-label" for="'+ id +'">',
+        '    <span class="sr-only">Select All<span>',
+        '  </label>',
+        '</div>'
+      ].join('\n'));
       this.delegateEvents();
       return this;
     }
