diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index aedba4e0..a1c133ab 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2695,14 +2695,14 @@ define('tools.querytool', [
 
       rows_to_delete: function(data) {
         var self = this,
-          tmp_keys = self.primary_keys;
+          tmp_keys = _.keys(self.primary_keys);
 
         // re-calculate rows with no primary keys
         self.temp_new_rows = [];
         data.forEach(function(d, idx) {
           var p_keys_list = _.pick(d, tmp_keys),
             is_primary_key = Object.keys(p_keys_list).length ?
-              p_keys_list[0] : undefined;
+              true : false;
 
           if (!is_primary_key) {
             self.temp_new_rows.push(idx);
@@ -2776,7 +2776,7 @@ define('tools.querytool', [
               self.data_store.deleted = self.data_store.staged_rows;
               self.data_store.staged_rows = {};
               // Save the changes on server
-              self._save();
+              self._save(undefined, undefined, undefined, true);
             },
             function() {
               // Do nothing as user canceled the operation.
@@ -2792,7 +2792,7 @@ define('tools.querytool', [
        * the ajax call to save the data into the database server.
        * and will open save file dialog conditionally.
        */
-      _save: function(view, controller, save_as) {
+      _save: function(view, controller, save_as, only_delete) {
         var self = this,
           save_data = true;
 
@@ -2833,7 +2833,19 @@ define('tools.querytool', [
           );
 
           // Add the columns to the data so the server can remap the data
-          var req_data = self.data_store;
+
+          var req_data = undefined,
+            success_msg = undefined;
+
+          if (only_delete === true) {
+            req_data = {'deleted': self.data_store.deleted};
+            success_msg = gettext('Data deleted successfully.');
+          }
+          else {
+            req_data = self.data_store,
+            success_msg = gettext('Data saved successfully.');
+          }
+
           req_data.columns = view ? view.handler.columns : self.columns;
 
           // Make ajax call to save the data
@@ -2904,22 +2916,34 @@ define('tools.querytool', [
 
                 grid.setSelectedRows([]);
 
-                // Reset data store
-                self.data_store = {
-                  'added': {},
-                  'updated': {},
-                  'deleted': {},
-                  'added_index': {},
-                  'updated_index': {},
-                };
+                if (only_delete === true) {
+                  // Reset data store for deleted items
+                  self.data_store.deleted = {};
 
-                // Reset old primary key data now
-                self.primary_keys_data = {};
+                  $('#btn-delete-row').prop('disabled', true);
+                  // Enable buttons if added or updated is true
+                  if (is_added || is_updated) {
+                    $('#btn-save').prop('disabled', false);
+                    $('#btn-download').prop('disabled', false);
+                  }
+                } else {
+                  // Reset data store
+                  self.data_store = {
+                    'added': {},
+                    'updated': {},
+                    'deleted': {},
+                    'added_index': {},
+                    'updated_index': {},
+                  };
+
+                  // Reset old primary key data now
+                  self.primary_keys_data = {};
 
+                }
                 // Clear msgs after successful save
                 self.set_sql_message('');
 
-                alertify.success(gettext('Data saved successfully.'));
+                alertify.success(success_msg);
               } else {
               // Something went wrong while saving data on the db server
                 $('#btn-flash').prop('disabled', false);
