defines the current data structure of Pivot
webix.ui({
view:"pivot",
structure: {
rows: ["form", "name"],
columns: ["year"],
values: [
{ name: "gdp", operation: "sum"},
{ name: "oil", operation: "sum"}
],
filters: [{name: "form"}]
}
});
The property stores the current data structure. Contains the following settings:
groupBy property in the "chart" modecolumns field in the "table" and "tree" modes.structure dynamicallyAs it is a reactive property you can also access and alter it via the widget state during application runtime:
$$("pivot").getState().structure = {/* new config */};
Another way to set structure at runtime is to call the setStructure method passing a structure object as a parameter:
$$("structures").attachEvent("onItemClick", function(id) {
var str = webix.copy(this.getItem(id).structure);
$$("pivot").setStructure(str);
});
structureYou can retrieve the current structure via the widget state:
$$("pivot").getState().structure;
Or using a dedicated getStructure method:
const structure = $$("pivot").getStructure();
/*
{
columns: ["year"],
filters: [ ... ],
groupBy: "year",
rows: ["form", 'name"],
values: [{name: "oil", operation: "min", color: "#e33fc7"}, ...]
}
*/