Skip to main content

update-field

Description

Fires when updating a field

Usage

"update-field": ({
id: string | number,
method: string,
area: string
}) => boolean;

Parameters

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

  • id - (required) the id of a field that is updated
  • method - (required) the method can be one of the following:
    • for the values area, it's a string with one of the data operation types: Default methods
    • for the rows and columns areas it can be data predicate value with one of the next values: "year", "quarter", "month", "week", "day", "hour", "minute". By default, a raw value is set. If a custom predicate or method is set, the id should be specified for the predicate or methods property.
  • area - (required) the name of the area where a field is updated, which can be "rows", "columns" or "values" area
info

For handling the inner events you can use the Event Bus methods

Example

const table = new pivot.Pivot("#root", {
fields,
data: dataset,
config: {
rows: ["studio", "genre"],
columns: [],
values: [
{
field: "title",
method: "count"
},
{
field: "score",
method: "max"
}
]
}
});
//output the id of a field that is updated to console
table.api.on("update-field", (ev) => {
console.log("The id of the field that was updated:", ev.id);
});

Related articles: