The default minimum and maximum column width in ag-grid can be established in the following way:
var gridOptions = {
//...
colMinWidth: 100,
colMaxWidth: 500
};
minWidth
and maxWidth
properties in the column definition:var columnDefs = [
{ field: 'athlete', minWidth: 150, maxWidth: 300 },
{ field: 'country' },
{ field: 'year' },
{ field: 'gold' },
{ field: 'silver' },
{ field: 'bronze' }
];
processCellForClipboard
callback to calculate the width of the cell content:var gridOptions = {
//...
processCellForClipboard: function(params) {
var cellWidth = calculateCellWidth(params.value);
var newParams = { value: params.value, $scope: params.$scope };
newParams.$scope.$agGridCellWidth = cellWidth;
return newParams;
},
getColWidth: function(params) {
var cellWidth = params.$scope.$agGridCellWidth;
return cellWidth + 20; // add some padding
}
};
function calculateCellWidth(value) {
// calculate the width of the cell content
}
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-08-13 11:00:00 +0000
Seen: 12 times
Last updated: Apr 11 '21
How can one ensure that sub-classes have uniform method parameters in TypeScript?
How can the calculation of matrix determinant be performed using CUDA?
How can code repetition be prevented when using (box)plot functions?
What steps can I take to prevent my webpage from slowing down when all parts of a div are displayed?
How can circles be detected in openCV?
What is the method to determine the most precise categorization of data using Self Organizing Map?