polished deletions
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-10-24 13:35:37 +02:00
parent d5264486c7
commit 301d303cc1
2 changed files with 11 additions and 4 deletions

View File

@ -23,7 +23,7 @@
vn-tooltip="Undo">
</vn-button>
<vn-button icon="delete"
ng-click="$ctrl.deleteAll('addRow')"
ng-click="$ctrl.deleteAll()"
vn-tooltip="Remove selected rows">
</vn-button>
<vn-button icon="save"

View File

@ -65,11 +65,18 @@ export default class SmartTable extends Component {
deleteAll() {
const data = this.model.data;
const checkedRows = data.filter(row => row.checked);
for (let row of checkedRows)
this.model.remove(row);
for (let row of checkedRows) {
if (row.id)
this.model.remove(row);
else {
const index = this.model.data.indexOf(row);
this.model.data.splice(index, 1);
}
}
if (this.autoSave)
this.save();
this.saveAll();
}
saveAll() {