Skip to main content

edit-rule

Description

Fires when opening the filter editor form

Usage

"edit-rule": ({
id?: string | number;
}) => void;

Parameters

The callback of the action takes an object with the following parameters:

  • id - (optional) the id of a rule that is edited

Example

import { getData } from "./common/data";
import { FilterBuilder } from "@svar-ui/react-filter";

export default function App() {
const { value, fields, options } = getData();

const init = (api) => {
api.on("edit-rule", (ev) => {
console.log("The id of the rule that was changed:", ev.id);
});
};

return (
`<FilterBuilder
value={value}
options={options}
fields={fields}
init={init}
/>`
);
}

Related articles: