-
Currently, the only way to resize a column is through the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The current solution I have come up with is the following: export function reset(
table: Table<{
[key: string]: any;
}>
) {
table.getAllLeafColumns().forEach(x => {
x.columnDef.size = 150;
});
table.resetColumnSizing(true);
table.resetHeaderSizeInfo(true);
} export function apply(
view: SavedTableView,
table: Table<{
[key: string]: any;
}>
) {
reset(table);
table.getAllLeafColumns().forEach(x => {
const col = view.columns.filter(c => c.id === x.id);
if(col.length > 0){
x.columnDef.size = col[0].size;
}
});
table.resetColumnSizing(true);
table.resetHeaderSizeInfo(true);
} To be honest, it feels a bit like a hack because of the hardcoded 150. |
Beta Was this translation helpful? Give feedback.
-
I have just found out that it already works with available functions: table.setColumnSizing(() => {
var obj: Record<string, number> = {};
view.columns.forEach(col => {
obj[col.id] = col.size;
});
return obj;
}); |
Beta Was this translation helpful? Give feedback.
I have just found out that it already works with available functions: