TreeTable - Lazy Lazy mode is handy to deal with large datasets, instead of loading the entire data, small chunks of data is loaded by invoking onLazyLoad callback everytime paging or sorting happens. In addition, children of a node can be loaded on demand at onNodeExpand event as well. Sample belows imitates lazy paging by using an in memory list.
{{col.header}} {{rowData[col.field]}}
View on GitHub

export class TreeTableLazyDemo }

    files: TreeNode[];

    cols: any[];

    totalRecords: number;

    loading: boolean;

    constructor(private nodeService: NodeService) } }

    ngOnInit() }
        this.cols = [
            } field: 'name', header: 'Name' },
            } field: 'size', header: 'Size' },
            } field: 'type', header: 'Type' }
        ];

        //in a production application, retrieve the logical number of rows from a remote datasource
        this.totalRecords = 1000;

        this.loading = true;
    }

    loadNodes(event) }
        this.loading = true;

        //in a production application, make a remote request to load data using state metadata from event
        //event.first = First row offset
        //event.rows = Number of rows per page
        //event.sortField = Field name to sort with
        //event.sortOrder = Sort order as number, 1 for asc and -1 for dec
        //filters: FilterMetadata object having field as key and filter value, filter matchMode as value

        //imitate db connection over a network
        setTimeout(() => }
            this.loading = false;
            this.files = [];

            for(let i = 0; i < event.rows; i++) }
                let node = }
                    data: }  
                        name: 'Item ' + (event.first + i),
                        size: Math.floor(Math.random() * 1000) + 1 + 'kb',
                        type: 'Type ' + (event.first + i)
                    },
                    leaf: false
                };

                this.files.push(node);
            }
        }, 1000);
    }

    onNodeExpand(event) }
        this.loading = true;

        setTimeout(() => }
            this.loading = false;
            const node = event.node;

            node.children = [
                }
                    data: }  
                        name: node.data.name + ' - 0',
                        size: Math.floor(Math.random() * 1000) + 1 + 'kb',
                        type: 'File'
                    },
                },
                }
                    data: }  
                        name: node.data.name + ' - 1',
                        size: Math.floor(Math.random() * 1000) + 1 + 'kb',
                        type: 'File'
                    }
                }
            ];

            this.files = [...this.files];
        }, 250);
        
    }
}

View on GitHub

<p-treeTable [value]="files" [columns]="cols" [paginator]="true" [rows]="10" [lazy]="true" 
    (onLazyLoad)="loadNodes($event)" [totalRecords]="1000" [loading]="loading" (onNodeExpand)="onNodeExpand($event)">
    <ng-template pTemplate="header" let-columns>
        <tr>
            <th *ngFor="let col of columns">
                {{col.header}}
            </th>
        </tr>
    </ng-template>
    <ng-template pTemplate="body" let-rowNode let-rowData="rowData" let-columns="columns">
        <tr>
            <td *ngFor="let col of columns; let i = index">
                <p-treeTableToggler [rowNode]="rowNode" *ngIf="i == 0"></p-treeTableToggler>
                {{rowData[col.field]}}
            </td>
        </tr>
    </ng-template>
</p-treeTable>