In my quest to make an angular ng-grid element with autosizing properties, I stumbled upon this code snippet:
for (var i = 0; i < $scope.dates.length; i++) {
var dateElement = {
field: 'reportMap.' + $scope.dates[i] + '.hours | round',
displayName: i + 1,
minWidth: "27px",
maxWidth: "46px"
};
if ($scope.holidays.indexOf(i + 1) != -1) {
dateElement.cellTemplate = 'app/partials/gridCell.html';
}
$scope.columns.push(dateElement);
.....
$scope.gridOptions = {
data: 'monthlyReports',
columnDefs: 'columns',
plugins: [new ngGridFlexibleHeightPlugin()],
enableRowSelection: false,
enableColumnResize: true,
enableSorting: false,
enableCellSelection: true
};
Even though I set a width limit, the column does not expand when content exceeds 4 characters. Perhaps using width: "auto"
would work, but I prefer controlled sizing...
Why doesn't the column adjust its width when the content grows beyond 27px?
I envision dynamic width based on content for my date elements:
Desiring flexible width and less padding around the numbers in the cell...