Is it possible to make a whole cell or row linkable in datatables?
Is it possible to make a whole cell or row linkable in datatables? I am using Metronic Vue demo7. Thank you!
Replies (1)
Hi,
Currently, our datatables component doesn't support linkable rows. However, you can make rows linkable by redirecting users in the click event.
const router = useRouter();
onMounted(()=>{
// collect all table rows
document.querySelectorAll(".table-selector-class tbody tr").forEach(item => {
// add click event on row element
item.addEventListener("click", (e)=>{
// redirect user to the page
router.push("/your-route-path")
})
})
}) Add a hover effect on your row.
<style>
.table-selector-class tbody tr:hover {
background-color: var(--bs-primary-light);
cursor: pointer;
}
</style> Regards,
Lauris Stepanovs,
Keenthemes Support Team