scinote-web/app/javascript/vue/shared/datatable/mixins/card_selector.js
2024-04-02 09:28:50 +01:00

21 lines
556 B
JavaScript

export default {
computed: {
cardSelected() {
const item = window.dtComponent.selectedRows.find((i) => (i.code === this.params.code));
return !!item;
}
},
methods: {
itemSelected() {
const item = window.dtComponent.selectedRows.find((i) => (i.code === this.params.code));
if (item) {
window.dtComponent.selectedRows = window.dtComponent.selectedRows
.filter((i) => (i.code !== this.params.code));
} else {
window.dtComponent.selectedRows.push(this.params);
}
},
},
};