1

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 Answers1

2

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"

StepUp
  • 36,391
  • 15
  • 88
  • 148
  • The problem is I can't use a paginator – Simon Lüscher Nov 25 '19 at 08:19
  • I get your point, that it is necessary if you're working with big datasets. But in my situation we are just talking about maybe 300 - 600 records. Basically virtual scrolling is just not the right approach in my situation due to other features I've implemented, which require jumping to specific positions in the list. – Simon Lüscher Nov 25 '19 at 10:06
  • @SimonLüscher so if you don't have any performance issues, then it is possible to use without `[virtualScroll]="true"`. – StepUp Nov 25 '19 at 10:13