Posted 5 August 2019, 6:25 am EST - Updated 3 October 2022, 7:46 pm EST
Dear all,
Anyone know how to custom column header name on FlexSheet ? I would like to custom the name instead of A,B,C,D.
Thanks.
Oskar Putra
Forums Home / Wijmo / General Discussion
Posted by: oskarputraa on 5 August 2019, 6:25 am EST
Posted 5 August 2019, 6:25 am EST - Updated 3 October 2022, 7:46 pm EST
Dear all,
Anyone know how to custom column header name on FlexSheet ? I would like to custom the name instead of A,B,C,D.
Thanks.
Oskar Putra
Posted 5 August 2019, 8:18 am EST
Hi Oskar,
To achieve the desired behavior, you may need to override the updateCell method of CellFactory of FlexSheet. Please refer to the code snippet and the sample below:
let oldCF = fheet.cellFactory.updateCell;
fSheet.cellFactory.updateCell = function(panel, row, col, cell, rng, updateContent) {
oldCF.call(this, panel, row, col, cell, rng, updateContent);
if(panel == fSheet.columnHeaders) {
let idx = cell.innerHTML.indexOf('<');
let oldHTML = cell.innerHTML.substr(idx);
cell.innerHTML = panel.columns[col].header + oldHTML;
}
}
https://stackblitz.com/edit/angular-fpbkr6
Regards,
Ashwin
Posted 5 August 2019, 8:38 am EST
Great, Thanks !