@@ -270,6 +270,9 @@ export class IgxPdfExporterService extends IgxBaseExporter {
270270 // Draw data rows
271271 pdf . setFont ( 'helvetica' , 'normal' ) ;
272272
273+ // Check if this is a tree grid export (tree grids can have both TreeGridRecord and DataRecord types for nested children)
274+ const isTreeGridExport = data . some ( record => record . type === ExportRecordType . TreeGridRecord ) ;
275+
273276 // For pivot grids, get row dimension columns to help with value lookup
274277 const rowDimensionColumnsByLevel : Map < number , any [ ] > = new Map ( ) ;
275278 if ( isPivotGrid && defaultOwner ) {
@@ -333,12 +336,14 @@ export class IgxPdfExporterService extends IgxBaseExporter {
333336 // Calculate indentation for hierarchical records
334337 // TreeGrid supports both hierarchical data and flat self-referencing data (with foreignKey)
335338 // In both cases, the base exporter sets the level property on TreeGridRecord
336- const isTreeGrid = record . type === 'TreeGridRecord' ;
339+ // Note: Nested child records without children are created as DataRecord type,
340+ // but they still have a level property and should be treated as tree grid records
337341 const recordIsHierarchicalGrid = record . type === 'HierarchicalGridRecord' ;
338342
339343 // For tree grids, indentation is visual (in the first column text)
340344 // For hierarchical grids, we don't use indentation (level determines column offset instead)
341- const indentLevel = isTreeGrid ? ( record . level || 0 ) : 0 ;
345+ // If this is a tree grid export and the record has a level property, use it for indentation
346+ const indentLevel = ( isTreeGridExport && record . level !== undefined ) ? ( record . level || 0 ) : 0 ;
342347 const indent = indentLevel * indentSize ;
343348
344349 // Draw parent row
0 commit comments