Can I use the lazy-option of the Angular PrimeNG treeTable without virtual scroll?

1.8k Views Asked by At

Hey guys i stumbled about some problems with the lazy loading option of the prime ng treeTable. I need to use the lazyLoad event (Output property "onLazyLoad") without the virtual scroller behavior. Is this somehow supported by the treeTable component?

Something like this:

<p-treeTable [value]="virtualFiles" [columns]="cols" [scrollable]="true" [rows]="20" 
    [virtualRowHeight]="34" [lazy]="true" (onLazyLoad)="loadNodes($event)"
    [totalRecords]="totalRecords" scrollHeight="400px">
</p-treeTable>

If it's not possible to use lazy loading without the virtual scroller it would be okay if I at least could prevent it from destroying the previous loaded Elements.

I already tried setting the rows-property to the length of the values-array to prevent fetching more data when scrolling upwards.

Would be great if someone could help me with this.

1

There are 1 best solutions below

3
StepUp On

In my view, virtual scrolling is an alternative to paging.

How does it work?

From my point of view, the virtual scrolling relies on calculations that are based on the [virtualRowHeight]="34" and [rows]="20", and then it calculates the desired size of data to be loaded. So, it is necessary to predefine [virtualRowHeight] and [rows], to ensure the proper functioning of the data virtualization, loading, and rendering of the correct items.

So when you work with many rows, it is necessary to use [virtualScroll]="true"