diff --git a/src/slick.grid.ts b/src/slick.grid.ts index 0506b9ce..08865e31 100644 --- a/src/slick.grid.ts +++ b/src/slick.grid.ts @@ -2735,6 +2735,11 @@ export class SlickGrid = Column, O e const rowInfo = {} as RowInfo; rowInfo.colIndex = colIndex; rowInfo.rowCount = this.getDataLength(); + + if (rowInfo.rowCount === 0) { + return autoSize.headerWidthPx; + } + rowInfo.startIndex = 0; rowInfo.endIndex = rowInfo.rowCount - 1; rowInfo.valueArr = null; @@ -2769,7 +2774,7 @@ export class SlickGrid = Column, O e if (autoSize.valueFilterMode === ValueFilterMode.GetGreatestAndSub) { // get greatest abs value in data let maxVal; - let maxAbsVal = 0; + let maxAbsVal = -1; for (i = rowInfo.startIndex; i <= rowInfo.endIndex; i++) { tempVal = rowInfo.getRowVal(i); if (Math.abs(tempVal) > maxAbsVal) {