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": "continent",
"value": {
"condition": {
"filter": "c",
"type": "notContains"
},
"includes": [
"Europe",
"Asia"
]
}
}
]
}
});
The property stores the current data structure. Contains the following settings:
groupBy property in the "chart" mode{ condition: "contains", value: "a" } null are equal to "select all".
The empty array unselects all values (the result of filtering will be empty).columns 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: [{
"name": "continent",
"value": {"condition": {"filter": "c", "type": "notContains"}} }, ...],
groupBy: "year",
rows: ["form", 'name"],
values: [{name: "oil", operation: "min", color: "#e33fc7"}, ...]
}
*/