api.setNext()
Description
Allows adding some action into the Event Bus orderUsage
api.setNext(next: any): void;
Parameters
next
- (required) the action to be included into the Event Bus order
Example
import { FilterBuilder } from "@svar-ui/react-filter";
import { getData } from "./common/data";
const { value, fields, options } = getData();
function CustomActions() {
return class {
constructor(api) {
api.on("change", (value) => {
console.log("Filter value changed:", value);
});
}
};
}
const init = (api) => {
api.setNext(CustomActions()); // Add custom action to Event Bus
};
export default function App() {
return (
`<FilterBuilder
fields={fields}
value={value}
options={options}
init={init}
/>`
);
}
Related articles: How to access FilterBuilder API