api.exec()
Description
Allows triggering the FilterBuilder actionsUsage
api.exec(
action: string,
config: object
): void;
Parameters
action
- (required) an action to be firedconfig
- (required) the config object with parameters (see the action to be fired)
Actions
info
The full list of the FilterBuilder actions can be found here
Example
<script>
import { getData } from "./common/data";
import { FilterBuilder } from "wx-svelte-filter";
import { Button } from "wx-svelte-core";
const { value, fields, options } = getData();
let execAddRule;
const init = (api) => {
execAddRule = () => {
api.exec("add-rule", {
rule: {
field: "name",
type: "text",
includes: ["Daisy"],
},
edit: false
});
};
};
</script>
<Button type="primary" click={execAddRule}>Add Rule</Button>
<FilterBuilder {value} {fields} {options} {init} />
Related articles: