1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: edit rows from tables without a primary key

This commit is contained in:
2021-01-30 14:58:12 +01:00
parent 574d493908
commit 5940b0b842
2 changed files with 41 additions and 21 deletions

View File

@ -69,7 +69,7 @@
class="tr"
:class="{'selected': selectedRows.includes(row._id)}"
@select-row="selectRow($event, row._id)"
@update-field="updateField($event, getPrimaryValue(row))"
@update-field="updateField($event, row)"
@contextmenu="contextMenu"
/>
</template>
@ -253,19 +253,18 @@ export default {
refreshScroller () {
this.resizeResults();
},
updateField (payload, id) {
if (!this.primaryField)
this.addNotification({ status: 'warning', message: this.$t('message.unableEditFieldWithoutPrimary') });
else {
const params = {
primary: this.primaryField.name,
schema: this.getSchema(this.resultsetIndex),
table: this.getTable(this.resultsetIndex),
id,
...payload
};
this.$emit('update-field', params);
}
updateField (payload, row) {
delete row._id;
const params = {
primary: this.primaryField.name,
schema: this.getSchema(this.resultsetIndex),
table: this.getTable(this.resultsetIndex),
id: this.getPrimaryValue(row),
row,
...payload
};
this.$emit('update-field', params);
},
deleteSelected () {
const rows = this.localResults.filter(row => this.selectedRows.includes(row._id)).map(row => {