api.on()
Description
Allows attaching a handler to the inner eventsUsage
api.on(
event: string,
handler: function
): void;
Parameters
event
- (required) an event to be firedhandler
- (required) a handler to be attached (the handler arguments will depend on the event to be fired)
Example
import { getData } from "./common/data";
import { FilterBuilder } from "@svar-ui/react-filter";
const { data, fields, options } = getData();
const init = (api) => {
api.on("edit-rule", ({ id }) => {
console.log(id);
});
};
export default function App() {
return `<FilterBuilder data={data} fields={fields} options={options} init={init} />`;
}
Related articles: How to access FilterBuilder API