Skip to main content

api.exec()

Description

Allows triggering the FilterBuilder actions

Usage

api.exec(
action: string,
config: object
): void;

Parameters

  • action - (required) an action to be fired
  • config - (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 setup>
import { getData } from "./common/data";
import { FilterBuilder } from "@svar-ui/vue-filter";
import { Button } from "@svar-ui/vue-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>

<template>
<Button type="primary" :click="execAddRule">Add Rule</Button>
<FilterBuilder :value="value" :fields="fields" :options="options" :init="init" />
</template>

Related articles: