Skip to content

Commit

Permalink
add missing --table-width to DataTable component
Browse files Browse the repository at this point in the history
  • Loading branch information
kenkunz committed Dec 9, 2024
1 parent 1003f28 commit 7b2daaf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/components/datatable/TableBody.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
const { pageIndex, pageSize } = page ?? {};
let offsetWidth: number;
function getRowIndex(pageRowIndex: number) {
if ($pageIndex !== undefined && $pageSize !== undefined) {
return $pageIndex * $pageSize + pageRowIndex + 1;
Expand All @@ -19,7 +21,7 @@
</script>

<!-- --table-width needed for proper tr.targetable styling -->
<tbody {...attrs}>
<tbody {...attrs} bind:offsetWidth style:--table-width="{offsetWidth}px">
{#each rows as row, pageRowIndex (row.id)}
<Subscribe rowAttrs={row.attrs()} let:rowAttrs>
<TableRow attrs={rowAttrs} cells={row.cells} index={getRowIndex(pageRowIndex)} targetable={targetableRows} />
Expand Down

0 comments on commit 7b2daaf

Please sign in to comment.