Commit 3ee6ed17 authored by Andrzej Obracaj's avatar Andrzej Obracaj
Browse files

multi row delete

parent cf88d654
......@@ -96,7 +96,7 @@ export default {
};
},
mounted() {
this.settings.afterSelectionEnd = this.selectRowOnly;
//this.settings.afterSelectionEnd = this.selectRowOnly;
this.settings.dropdownMenu = false;
this.settings.contextMenu = ContextMenu(this);
Notify.loadData(null, this.loadInitialData);
......@@ -182,24 +182,38 @@ export default {
this.edit = true;
},
onDeleteSamplingPoints(t, o) {
const clickedRow = o[0].start.row;
const hot = this.$refs.hot.hotInstance;
const physicalIndex = hot.toPhysicalRow(clickedRow);
let row = hot.getSourceDataAtRow(physicalIndex);
const rowNr = o[0].end.row;
const startRow = o[0].start.row;
Notify.prompt(async response => {
if (response) {
await Notify.loadData(
"Please wait while data is deleting",
async () => {
const rowsAffected = await SamplingpointsService.delete(row.id);
const activeEditor = hot.getActiveEditor();
hot.alter("remove_row", clickedRow, 1);
}
);
Notify.success("Sampling Points deleted!");
}
}, "This will delete all data connected to this Sampling Point. <br/><br/>Do you want to continue?");
const hot = this.$refs.hot.hotInstance;
debugger;
var arrayIds = [];
for (let index = startRow; index < rowNr+1; index++) {
var row = hot.getDataAtRow(index);
arrayIds.push(row[0]);
}
debugger;
Notify.prompt(async response => {
if (response) {
await Notify.loadData(
"Please wait while data is deleting",
async () => {
for (let index = 0; index < arrayIds.length; index++) {
//var row = hot.getDataAtRow(index);
const rowsAffected = await SamplingpointsService.delete(arrayIds[index]);
}
const activeEditor = hot.getActiveEditor();
hot.alter("remove_row", clickedRow, 1);
}
);
Notify.success("Sampling Points deleted!");
}
}, "This will delete all data connected to this Sampling Point. <br/><br/>Do you want to continue?");
},
async onSaveSamplingPoints(samplingPoint) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment