Skip to content

Commit

Permalink
Make use of collection_id when no item_id in data table
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Oct 1, 2024
1 parent 7a6d373 commit 3d5a382
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions webapp/src/components/DynamicDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ export default {
methods: {
goToEditPage(event) {
const row = event.data;
let row_id = null;
// Check if the row has an item ID, otherwise default to collection ID
if (!row.item_id && row.collection_id) {
row_id = row.collection_id;
} else {
row_id = row.item_id;
}
if (event.originalEvent.target.classList.contains("checkbox")) {
return null;
Expand All @@ -233,9 +241,9 @@ export default {
event.originalEvent.metaKey ||
event.originalEvent.altKey
) {
window.open(`/${this.editPageRoutePrefix}/${row.item_id}`, "_blank");
window.open(`/${this.editPageRoutePrefix}/${row_id}`, "_blank");
} else {
this.$router.push(`/${this.editPageRoutePrefix}/${row.item_id}`);
this.$router.push(`/${this.editPageRoutePrefix}/${row_id}`);
}
},
getComponentProps(componentName, data) {
Expand Down

0 comments on commit 3d5a382

Please sign in to comment.