Vasilis
September 25, 2014, 10:29am
1
Dear all,
I would like to develop a web app that will use your widget. In particular, it will use the “Webix Pivot” widget. I am trying to customize the widget, and one feature that I would like to add is to sum the values of each column. I tried to use a footer, but I did not succeed. Could you please instruct me on how to add this feature?
Thank you,
Vasilis
Bronwen
September 26, 2014, 5:02pm
2
This will not directly solve your problem, but the export to excel feature can be used and then add totals to the spreadsheet.
Helga
September 29, 2014, 6:48am
3
Hello Vasilis,
You can access the grid view object inside the Pivot as
var grid = $$("pivot").$$("data");
And then define a footer for the needed column(s) for the grid:
grid.define("footer", true);
grid.config.columns[1].footer = { content:"summColumn" };
grid.config.columns[2].footer = { content:"summColumn" };
...
grid.refreshColumns();
It throws error
Uncaught TypeError: Cannot set property ‘footer’ of undefined
Maria
May 19, 2015, 4:33pm
5
Uncaught TypeError: Cannot set property ‘footer’ of undefined
This code snippet should be called after data loading (when pivot has rendered the datatable with all its columns):
var grid = $$("pivot").$$("data");
grid.define("footer", true);
grid.attachEvent("onAfterLoad",function(){
for(var i=1; i < grid.config.columns.length;i++){
grid.config.columns[i].footer = { content:"summColumn" };
}
grid.refreshColumns();
});
Thank you. It’s worked now.
What about to add horizontal total column?
Maria
May 21, 2015, 10:07am
7
Hi,
Сould you provide more details ? Didn’t the footer solve the issue ?
Footer works fine. But also I want to see the total per year. I want to sum up horizontally.
By the way I couldn’t do sorting. I want to sort them in browser (not server)
Maria
May 22, 2015, 12:27pm
9
Pivot creates columns only for data properties. But you can try to add columns to the end of the datatable and set values you need:
Webix Documentation: Learn how you can configure columns of the DataTable widget: add or delete columns dynamically, group columns, use styles, etc.
By the way I couldn’t do sorting.
Locally built-in sorting works correctly. Perhaps you could give some example ?