Resize by Cell Content
defineGrid() {
this.columnDefinitions = [
{ id: 'action', field: 'action', name: 'Action', width: 50, maxWidth: 50 },
{ id: 'firstName', field: 'firstName', name: 'First Name', mindWidth: 100 },
{ id: 'lastName', field: 'lastName', name: 'First Name', mindWidth: 100, resizeExtraWidthPadding: 10 },
// ...
];
this.gridOptions = {
// ...
enableAutoResize: true,
// resizing by cell content is opt-in
// we first need to disable the 2 default flags to disable autoFit/autosize
autoFitColumnsOnFirstLoad: false,
enableAutoSizeColumns: false,
// then enable resize by content with these 2 flags
autosizeColumnsByCellContentOnFirstLoad: true,
enableAutoResizeColumnsByCellContent: true,
};
}Last updated