Skip to content

Commit d5ffb6a

Browse files
committed
Fix filter menu not being rendered correctly for sticky thead
1 parent d3f0ec5 commit d5ffb6a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/lib/components/Table/TableContent.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,7 @@
491491
<!-- Adding column filter config -->
492492
{#if cell.isData()}
493493
{#if props.colFilter?.render}
494-
<div class="">
495-
<Render of={props.colFilter.render} />
496-
</div>
494+
<Render of={props.colFilter.render} />
497495
{/if}
498496
{/if}
499497
</div>
@@ -564,3 +562,5 @@
564562
{/if}
565563
{/if}
566564
</div>
565+
566+
<div id="{tableId}-popups" />

src/lib/components/Table/TableFilter.svelte

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import Fa from 'svelte-fa/src/fa.svelte';
3+
import { onMount } from 'svelte';
34
import { faFilter, faPlus, faXmark } from '@fortawesome/free-solid-svg-icons';
45
import { popup } from '@skeletonlabs/skeleton';
56
import type { PopupSettings } from '@skeletonlabs/skeleton';
@@ -221,9 +222,17 @@
221222

222223
// Start by adding the default filter
223224
$: addFilter(options[type][0].value, undefined);
225+
226+
onMount(() => {
227+
const element = document.getElementById(popupId);
228+
if (element && element.parentElement?.id === `parent-${popupId}`) {
229+
element.parentElement?.removeChild(element);
230+
document.getElementById(`${tableId}-popups`)?.appendChild(element);
231+
}
232+
});
224233
</script>
225234

226-
<form class="">
235+
<div id="parent-{popupId}">
227236
<button
228237
class:variant-filled-primary={active}
229238
class="btn w-max p-2"
@@ -234,7 +243,7 @@
234243
<Fa icon={faFilter} size="12" />
235244
</button>
236245

237-
<div data-popup={`${popupId}`} id={popupId} class="z-50">
246+
<div data-popup={popupId} id={popupId} class="">
238247
<div class="card p-3 grid gap-2 shadow-lg w-max bg-base-100">
239248
<button
240249
class="btn variant-filled-primary btn-sm"
@@ -326,4 +335,4 @@
326335
>
327336
</div>
328337
</div>
329-
</form>
338+
</div>

0 commit comments

Comments
 (0)