public inbox for [email protected]
help / color / mirror / Atom feedFrom: Rahul Shirsat <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin] RM6098 Manually deleting from table view hangs
Date: Mon, 18 Jan 2021 20:21:04 +0530
Message-ID: <CAKtn9dNkLaiMxAn05=HNJZ3w4LgcC9iLh3yZvwDTE3yLVCXgaw@mail.gmail.com> (raw)
Hi Hackers,
Please find the attached patch which resolves the issue of deleting records
when the user tries to delete multiple records step by step.
--
*Rahul Shirsat*
Senior Software Engineer | EnterpriseDB Corporation.
Attachments:
[application/octet-stream] RM6098.patch (2.0K, 3-RM6098.patch)
download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 05deebc41..eb32c06f2 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -3544,17 +3544,33 @@ define('tools.querytool', [
// Remove deleted rows from client as well
if (is_deleted) {
var rows = _.keys(self.data_store.deleted);
+
if (data_length == rows.length) {
// This means all the rows are selected, clear all data
data = [];
dataView.setItems(data, self.client_primary_key);
} else {
dataView.beginUpdate();
- for (var j = 0; j < rows.length; j++) {
- var item = grid.getDataItem(rows[j]);
- data.push(item);
- dataView.deleteItem(item[self.client_primary_key]);
+
+ var selectedRows = RangeSelectionHelper.getIndexesOfCompleteRows(grid, grid.getSelectionModel().getSelectedRanges());
+
+ var primary_keys = _.values(self.data_store.deleted);
+
+ for (var j = 0; j < selectedRows.length; j++) {
+ var item = grid.getDataItem(selectedRows[j]);
+ _.each(primary_keys, function(v) {
+
+ let actual_prim_delete_key = _.keys(v)[0];
+ let actual_prim_delete_value = _.values(v)[0];
+ let selected_prim_delete_value = item[actual_prim_delete_key];
+
+ if(actual_prim_delete_value == selected_prim_delete_value) {
+ data.push(item);
+ dataView.deleteItem(item[self.client_primary_key]);
+ }
+ });
}
+
dataView.endUpdate();
}
self.rows_to_delete.apply(self, [data]);
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin] RM6098 Manually deleting from table view hangs
In-Reply-To: <CAKtn9dNkLaiMxAn05=HNJZ3w4LgcC9iLh3yZvwDTE3yLVCXgaw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox