Handle composite primary keys correctly when deleting rows in the Edit Grid. Fixes #2425

REL-1_X
Khushboo Vashi 2017-06-06 09:58:47 +01:00 committed by Dave Page
parent 4b74a5ff35
commit d21cbb8b1f
1 changed files with 11 additions and 7 deletions

View File

@ -726,14 +726,18 @@ define(
// Clear selection model if row primary keys is set to default
var row_data = _.clone(collection[selected_rows_list[count]]),
is_primary_key = _.has(row_data, primary_key_list) &&
row_data[0] != undefined ? true : false;
is_primary_key = true;
if (primary_key_list.length &&
!is_primary_key && !is_new_row
) {
this.selection.setSelectedRows([]);
selected_rows_list = [];
// Primary key validation
_.each(primary_key_list, function(pk) {
if (!(_.has(row_data, pk)) || row_data[pk] == undefined) {
is_primary_key = false;
}
})
if (primary_key_list.length && !is_primary_key && !is_new_row) {
this.selection.setSelectedRows([]);
selected_rows_list = [];
}
}