polished deletions
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d5264486c7
commit
301d303cc1
|
@ -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"
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue