Posted 18 May 2020, 5:03 pm ESTDear support,
I am wondering whether there is a neat way to autosize all columns based on both
- header name
- column data
and execute following code in console:
pivotGrid = wijmo.Control.getControl($('wj-pivot-grid'))
You will see column widths have changed. This is the trick we are currently using to resize columns in PivotGrid.
However there's still a problem here. After doing pivotGrid.autoSizeColumns(), if you click any of the column headers for sorting purpose, the column would go back to its original size... Is there a way to solve this issue?
An interesting finding is that if you change columns width manually, e.g. drag-n-drop column borders, its width would then be persisted. It looks like changing column width manually would not only write the new width to pivotGrid.columns[index].width, but also to ngFmt.fields[index].width, however calling autoSizeColumns() function wouldn't have any effect in ngFmt.fields. I guess there might be a missing event not being triggered by autoSizeColumns() API but by manually drag-n-drop columns borders.
We hope you can help us to find a neat way of auto sizing pivot grid columns.