Skip to main content

delete-rule

Description

Fires when deleting a filtering rule
info

When the last rule in a group is deleted, the group is also removed.

Usage

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

Parameters

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

  • id - the id of a deleted rule

Example

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

function Example() {
const { value, fields, options } = getData();

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

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

export default Example;

Related articles: