oncancel
Description
A function that is called on click of the Cancel buttonUsage
oncancel: (
value: {
field: string | number,
type?: "number" | "text" | "date" | "tuple",
predicate?: "month" | "year",
filter?: string,
includes?: any[],
value?: any,
}
) => void;
Parameters
The callback of the event takes the value object with the following parameters:
field- (required) the id of a field. It should be one of the field id from thefieldsproperty, if it is definedtype- (optional) filter type: "text" (default) | "number" | "date" | "tuple"filter- (optional) the filter operator available for this typepredicate- (optional) Date part extractor ("month" or "year") for date fieldsvalue- (optional) the value in the input fieldincludes- (optional) an array of the included values (strings, numbers or dates).
Example
<script>
import { getData } from "../data";
import { FilterEditor } from "@svar-ui/svelte-filter";
const { fields, options } = getData();
function handleCancel() {
console.log("Rule not applied")
}
</script>
<FilterEditor
field="age"
{options}
oncancel={handleCancel}
/>
Related articles: FilterEditor Guide