задает настройки для 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"
]
}
}
]
}
});
Объект содержит следующие поля:
groupBy в режиме "chart"{ condition: "contains", value: "a" } null are equal to "select all".
The empty array unselects all values (the result of filtering will be empty).columns в режимах "table" и "tree".structure динамическиТ.к. это реактивное свойство, вы можете получить доступ к нему, а также изменить его значение динамически через состояние виджета:
$$("pivot").getState().structure = {/* новые настройки */};
Ещё один способ — вызов метода setStructure с объектом настроек в качестве параметра:
$$("structures").attachEvent("onItemClick", function(id) {
var str = webix.copy(this.getItem(id).structure);
$$("pivot").setStructure(str);
});
structureВы можете получить текущие настройки через состояние виджета:
$$("pivot").getState().structure;
или же с помощью метода getStructure:
const structure = $$("pivot").getStructure();
/*
{
columns: ["year"],
filters: [
{
name: "continent",
value: {
condition: {
"filter": "c",
"type": "notContains"
},
includes: [
"Europe",
"Asia"
]
}
}
],
groupBy: "year",
rows: ["form", 'name"],
values: [{name: "oil", operation: "min", color: "#e33fc7"}, ...]
}
*/