updateColumnDefinition on a frozen column throws in ResizeColumns and permanently corrupts frozen column offsets
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/tabulator-tables/6.5.2/js/tabulator.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tabulator-tables/6.5.2/css/tabulator.css"></link>
<div id="example-table"></div>
<pre id="log">running…</pre>
JavaScript
var out = [];
function log(){
out.push([].slice.call(arguments).join(' '));
document.getElementById('log').textContent = out.join('\n');
}
var table = new Tabulator("#example-table", {
height: 200,
layout: "fitDataFill",
data: [{a:"a1",b:"b1",c:"c1",d:"d1"},{a:"a2",b:"b2",c:"c2",d:"d2"}],
rowHeader: {resizable:false, frozen:true, width:55, formatter:"rownum", editor:false},
columnDefaults: {resizable:"header", width:120},
columns: [
{title:"Actions", frozen:true}, // frozen, no field
{title:"A", field:"a", frozen:true}, // the frozen column we relabel
{title:"B", field:"b"},
{title:"C", field:"c"},
{title:"D", field:"d"},
],
});
function snap(){
return table.modules.frozenColumns.leftColumns.map(function(c){
return (c.field || "(no field)") + "@" + c.modules.frozen.margin;
}).join(" | ");
}
table.on("tableBuilt", function(){
log("BEFORE:", snap());
table.updateColumnDefinition("a", {title:"A renamed", frozen:true})
.then(function(){ log("promise: resolved cleanly"); })
.catch(function(e){ log("promise: REJECTED -", e && e.message ? e.message : e); });
setTimeout(function(){
log("AFTER: ", snap());
log("columnsByIndex:", table.columnManager.columnsByIndex.length);
}, 400);
});