I have a grid that uses javascript to perform calculations on the group total rows as described in other posts, to properly calculate certain earned value metrics fields, including percent complete and PF:
When exporting the grid to excel, or using the copy/paste functionality, the basic summed values are exported/copied rather than the updated values:
The formatting changes that are made through the same javascript are exporting properly:
// SampleGridFunctions.aggregatePF // panel: https://demos.wijmo.com/5/Angular/WijmoHelp/WijmoHelp/topic/wijmo.grid.GridPanel.Class.html // row: index of the row // column: index of the column // cell: HTMLElement aggregatePF: function(panel, row, column, cell) { var _column = panel.columns[column]; var _row = panel.rows[row]; var _binding = _column.binding; var _item = _row.dataItem; var group = _row instanceof wijmo.grid.GroupRow ? _item : null; var itemPF = _item.PF; var _class = ''; if (_binding == 'PF' && _item !==undefined) { var amount = group ? group.getAggregate('Sum', 'Earned') / group.getAggregate('Sum', 'Actual') : itemPF; if (isNaN(amount) || !isFinite(amount)) { amount = ''; } cell.textContent = wijmo.Globalize.format(amount); if (amount <= 0.95) { _class = 'font-red-threshold'; wijmo.addClass(cell, _class); } } if (itemPF <= 0.95) { _class = 'font-red-threshold'; wijmo.addClass(cell, _class); } },
Thanks,
Coy Kissee
Hello @Coy Kissee
The method aggregatePF runs on formatItems to handle the custom math you need. Am I right?
Could you send us a sample, we can use it here for tests and playground here.
Kind regards,
Ricardo Valim
Ricardo,
The JS is called is OSCellRenderer.
If there is someplace else that this JS should be called from in order to make it perform as I expect, please let me know.
Could you send me your sample? Without data, what is believe its critic for you, I would like to see how columns are configured.
Can I send you the OML file directly? I'd rather not pot the whole solution publicly.
just sent you a private message! =D