FormulaeColumnsIssue
by handsoncode
HTML
<div id="example2" class="hot handsontable htRowHeaders htColumnHeaders" style="height: 320px; overflow: hidden; width: 100%;" data-originalstyle="height: 320px; overflow: hidden; width: 100%;"></div>
CSS
</style><!-- Ugly Hack due to jsFiddle issue -->
<script type="text/javascript" src="
https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js"></script>
<link rel="stylesheet" href="
https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.css"
/>
JavaScript
var colArray=['Description','Yearly', 'GrossPay', 'Deduction1', 'Deduction2', 'Audited Pay'];
var data=[
["Total","=SUM(B2:B20000)","=SUM(C2:C20000)","=SUM(D2:D20000)","=SUM(E2:E20000)","=SUM(F2:F20000)"],
["TestRow1","170","=IF(SUM(B2:B2)>0,SUM(B2:B2),\"\")","40","50","=IF(ROUND(SUM(ROUND((D2*(-50.00/100)),0),ROUND((E2*(-33.33/100))),0),ROUND(C2,0)),0)>0,ROUND(SUM(2,2),0),ROUND(C2,0)),0),\"\")"],
["TestRow2","70","=IF(SUM(B3:B3)>0,SUM(B3:B3),\"\")","20","10","=IF(ROUND(SUM(ROUND((D2*(-50.00/100)),0),ROUND((E2*(-33.33/100))),0),ROUND(C2,0)),0)>0,ROUND(SUM(2,2),0),ROUND(C2,0)),0),\"\")"],
["TestRow3","740","=IF(SUM(B4:B4)>0,SUM(B4:B4),\"\")","30","40","=IF(ROUND(SUM(ROUND((D2*(-50.00/100)),0),ROUND((E2*(-33.33/100))),0),ROUND(C2,0)),0)>0,ROUND(SUM(2,2),0),ROUND(C2,0)),0),\"\")"],
["TestRow4","420","=IF(SUM(B5:B5)>0,SUM(B5:B5),\"\")","50","60","=IF(ROUND(SUM(ROUND((D2*(-50.00/100)),0),ROUND((E2*(-33.33/100))),0),ROUND(C2,0)),0)>0,ROUND(SUM(2,2),0),ROUND(C2,0)),0),\"\")"]
];
const hyperformulaInstance = HyperFormula.buildEmpty({
// to use an external HyperFormula instance,
// initialize it with the `'internal-use-in-handsontable'` license key
licenseKey: 'internal-use-in-handsontable',
});
var hot = new Handsontable(example2, {
data:data,
startRows: 8,
startCols: 8,
multiColumnSorting: {
sortEmptyCells: false,
indicator: true,
headerAction: true,
compareFunctionFactory: function (sortOrder, columnMeta) {
// implement your own comparator
return function (value, nextValue) {
if (value < nextValue) {
return -1;
}
if (value > nextValue) {
return 1;
}
return 0;
}
}
},
height:'auto',
width: 'auto',
stretchH: 'all',
allowRemoveColumn: false,
copyPaste: {
//set the...