I am trying to use a dispatch event from https://carbon-components-svelte.onrender.com/components/DataTable namely the: on:click:row--select { selected: boolean; row: DataTableRow; }
but i cannot get it to work
I found the custom event:
["click:row--select"]: CustomEvent<{
selected: boolean;
row: DataTableRow;
}>;
But i dont know how to integrate it with my code
addEventListener("click:row--select", handleSelect);
function handleSelect(e) {
e.selected;
e.Modal;
}
Events in Svelte are added on the component as attributes starting with on:
, so somewhere in the markup you should have:
<DataTable ... on:click:row--select={handleSelect}>