Replies: 1 comment
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, the only way to resize a column is through the
header.getResizeHandler()
method. I try to save the current user column setup (which works), but I can't load and apply the saved widths. Setting the columnDef withcolumn.columnDef.size = 300;
will only take effect after a rerender, which is not easy to trigger. An API where we can set the column size in the way we can access it (column.getSize()
) would be simple and straightforward. Something likecolumn.setSize(width: number) => void
.Beta Was this translation helpful? Give feedback.
All reactions