[RM#3605] View Data: Deleting N number of rows makes first N number of rows disable
Murtuza Zabuawala <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.pgadmin.devel |
|---|---|
| Message-ID | <CAKKotZSxcKgzyvDSted+WSHckEwDiFUAhxmEuj6A9FTHWk=tCw@mail.gmail.com> |
Hi, PFA minor patch to fix the issue where using view data, when we try to delete N row, it will make the first N row from the grid disabled, you try to double click on the cell and try to update the value of that row it will not open the editor. *Steps:* 1) Create a simple table as shown in screenshot. 2) Open view data for the table 3) Select row number 6 4) Click on Trash (delete button) 5) Click on Save grid icon 6) Try to update the first row's column b value -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
sample table.jpg
(image/jpeg, 64.8 KB) - not displayed
RM_3605.diff
(application/octet-stream, 1.3 KB)
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 60aa2e9d37..82f0d884ae 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2747,15 +2747,14 @@ define('pgadmin.tools.sqleditor', [
},
rows_to_delete: function(data) {
- var self = this,
- tmp_keys = self.primary_keys;
+ let self = this;
+ let tmp_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;
+ let p_keys_list = _.pick(d, _.keys(tmp_keys));
+ let is_primary_key = Object.keys(p_keys_list).length > 0;
if (!is_primary_key) {
self.temp_new_rows.push(idx);
@@ -2988,7 +2987,6 @@ define('pgadmin.tools.sqleditor', [
dataView.endUpdate();
}
self.rows_to_delete.apply(self, [data]);
- grid.setSelectedRows([]);
}
grid.setSelectedRows([]);