How can i speed up a autoFitColumn() on multi-headers grid?
In the screenshot you can see that each column fitting make Recalculate Styles. Is it possible to cache width of the fitted column without firing up CSS and then after all columns width are calculated use grid.setOptions() to set columns width with new fitted width?
Also i need to use dirty hack: hideColumn();showColumn() becouse footer isn't fitted to columns.
Table.prototype.fitColumns =
function
(){
var
self =
this
;
var
count = 0;
var
col;
var
selected =
this
.grid.select().data(
'uid'
);
for
(
var
i = 0; i <
this
.grid.columns.length; i++) {
var
multi =
this
.grid.columns[i].columns;
if
(multi){
_.forEach(multi,
function
(el, j){
if
(el.columns){
_.forEach(el.columns,
function
(el2, k){
col = multi[j].columns[k];
if
(!col.attributes || (col.attributes && !col.attributes.noFit)) self.grid.autoFitColumn(col);
});
}
else
{
col = multi[j];
if
(!col.attributes || (col.attributes && !col.attributes.noFit)) self.grid.autoFitColumn(col);
}
});
}
else
{
col = self.grid.columns[i];
if
(!col.attributes || (col.attributes && !col.attributes.noFit)) self.grid.autoFitColumn(col);
}
}
this
.grid.refresh();
this
.fitted =
true
;
if
(selected)
this
.grid.select(
"tr[data-uid='"
+ selected +
"']"
);
this
.grid.hideColumn(1);
this
.grid.showColumn(1);
};