api.intercept()
Description
Allows intercepting and preventing the inner events
Usage
api.intercept(
event: string,
callback: function
): void;
Parameters
event
- (required) an event to be firedcallback
- (required) a callback to be performed (the callback arguments will depend on the event to be fired)
Events
info
Example
The example shows how to make all collapsible rows close at the initialization.
// create Pivot
const table = new pivot.Pivot("#root", {
fields,
data: dataset,
config: {
rows: ["studio", "genre"],
columns: [],
values: [
{
field: "title",
method: "count"
},
{
field: "score",
method: "max"
}
]
}
});
//make all rows close at the initialization
table.api.intercept("render-table", (ev) => {
ev.config.data.forEach((row) => (row.open = false));
})
Related articles: render-table