Skip to main content

setConfig()

Description​

Updates the current configuration of the Pivot widget

The method is used to update the current configuration of the Pivot widget. It's useful when there's a need to update the underlying data set of the widget. The method preserves all the previously set options that are not explicitly provided in the setConfig call.

Usage​

setConfig(config: { [key:any]: any }): void;

Parameters​

  • config - (required) an object of the Pivot configuration. See the full list of properties here
important

The method changes only the parameters you passed. It destroys the current component and initializes a new one.

Example​

// 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"
}
]
}
});

//update configuration parameters
table.setConfig({
config: {
rows: ["studio", "genre", "duration"],
columns: [],
values: [
{
field: "title",
method: "count"
},
{
field: "score",
method: "max"
},
{
field: "type",
method: "count"
}
]
}
});