Skip to content

Commit eaddc76

Browse files
committed
Add search query to fetching function
1 parent c2aa3e2 commit eaddc76

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/lib/components/Table/TableContent.svelte

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,13 @@
352352
<!-- Enable the search filter if table is not empty -->
353353
{#if $data.length > 0}
354354
{#if !serverSide}
355-
<div class="flex gap-2">
355+
<form
356+
class="flex gap-2"
357+
on:submit|preventDefault={() => {
358+
sendModel.q = searchValue;
359+
$filterValue = searchValue;
360+
}}
361+
>
356362
<div class="relative w-full flex items-center">
357363
<input
358364
class="input p-2 border border-primary-500"
@@ -365,18 +371,20 @@
365371
class="absolute right-3 items-center"
366372
on:click|preventDefault={() => {
367373
searchValue = '';
374+
sendModel.q = '';
368375
$filterValue = '';
369376
}}><Fa icon={faXmark} /></button
370377
>
371378
</div>
372379
<button
373-
type="button"
380+
type="submit"
374381
class="btn variant-filled-primary"
375382
on:click|preventDefault={() => {
376383
$filterValue = searchValue;
384+
sendModel.q = searchValue;
377385
}}>Search</button
378386
>
379-
</div>
387+
</form>
380388
{/if}
381389
<div class="flex justify-between items-center py-2 w-full">
382390
<div>

0 commit comments

Comments
 (0)