updates
This commit is contained in:
@@ -4,9 +4,11 @@
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import SortFields from "./SortFields.svelte";
|
||||
import AppliedFilter from "./AppliedFilter.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import {getContext,createEventDispatcher} from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
export let sort;
|
||||
export let schema;
|
||||
export let operators;
|
||||
@@ -21,6 +23,21 @@
|
||||
|
||||
let csvUrl = url.pathname + "/csv?" + url.searchParams.toString();
|
||||
|
||||
function search(e){
|
||||
e.preventDefault();
|
||||
const data = new FormData(e.target);
|
||||
let filterKey = data.keys().next().value;
|
||||
let filterValue = data.values().next().value;
|
||||
const url = new URL(modalUrl ?? window.location.href);
|
||||
url.searchParams.set("skip", "0");
|
||||
url.searchParams.set(filterKey, filterValue);
|
||||
if (inModal) {
|
||||
dispatch("refresh", url);
|
||||
} else {
|
||||
window.location = url;
|
||||
}
|
||||
|
||||
}
|
||||
function uploadComplete(e) {
|
||||
records = e.detail;
|
||||
}
|
||||
@@ -49,9 +66,15 @@
|
||||
on:refresh
|
||||
/>
|
||||
|
||||
<form method="GET">
|
||||
<input type="search" name="filter[data.{schema.fields[0].name}_regex]" placeholder="Search"
|
||||
class="form-control" required>
|
||||
<form method="GET" on:submit={search}>
|
||||
{#if schema.fields[0]?.name}
|
||||
<input type="search" name="filter[data.{schema.fields[0].name }_regex]" placeholder="Search"
|
||||
class="form-control" required>
|
||||
{:else}
|
||||
<input type="search" name="filter[_file.originalName_regex]" placeholder="Search"
|
||||
class="form-control" required>
|
||||
{/if}
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user