Added a link type to the datatable columns.

This commit is contained in:
rocketdebris 2026-01-09 09:50:15 -05:00
parent 37a405a1f2
commit 1a7f0d872a

View file

@ -300,6 +300,12 @@
@click="$emit('rowClick', slotProps)"
/>
</template>
<template v-if="col.type === 'link'" #body="slotProps">
<button class="datatable-link"
@click="handleLinkClick(col, slotProps.data)">
{{ slotProps.data[col.fieldName] }}
</button>
</template>
</Column>
<!-- Actions Column -->
@ -1096,6 +1102,17 @@ const handleStatusButtonClick = (column, rowData) => {
}
};
// Handle link clicks
const handleLinkClick = (column, rowData) => {
try {
if (column.onLinkClick && typeof column.onLinkClick === "function") {
column.onLinkClick(rowData[column.fieldName], rowData);
}
} catch (error) {
console.error("Error executing link click:", error);
}
};
const getBadgeColor = (status) => {
switch (status?.toLowerCase()) {
case "paid":
@ -1634,4 +1651,18 @@ defineExpose({
transform: none;
box-shadow: none;
}
/* Link Styles */
.datatable-link {
background: none;
border: none;
padding: 0;
cursor: pointer;
outline: none;
}
.datatable-link:hover {
text-decoration: underline;
}
</style>