diff --git a/packages/components/src/components/data-grid/data-grid.tsx b/packages/components/src/components/data-grid/data-grid.tsx index d4637a8ec1..5b6db0ecc5 100644 --- a/packages/components/src/components/data-grid/data-grid.tsx +++ b/packages/components/src/components/data-grid/data-grid.tsx @@ -380,7 +380,7 @@ export class DataGrid { let maxLength = 0; let longestContent; rows.forEach((row) => { - const length = row[columnIndex].toString().length; + const length = row[columnIndex]?.toString()?.length || 0; if (length > maxLength) { longestContent = row[columnIndex]; maxLength = length;