api.getState()
Description
Gets the state object that stores current values of most FilterBuilder propertiesUsage
api.getState(): object;
Returns
The method returns an object with the following parameters:
{
value: {}; //an object that stores all the filters in a tree-like structure
fields: [];// the list of fields
options: {}; //the list of options for each field
}
Properties description you can find here: FilterBuilder properties overview
Example
<script>
import { getData } from "./common/data";
import { FilterBuilder } from "wx-svelte-filter";
const { value, fields, options } = getData();
const init = (api) => {
const { fields } = api.getState();
console.log(fields); // outputs the list of fields to console
}
</script>
<FilterBuilder {value} {options} {fields} {init} />
Related articles: How to access FilterBuilder API