primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Filtering is not working with Virtual scroll (Lazy loading) in PrimeNG data table. Filtering and lazy loading don't work together

Open akashdeepg12 opened this issue 9 years ago • 4 comments

Filtering is not working with Virtual scroll (Lazy loading) in PrimeNG data table. Filtering and lazy loading don't work together.

Is there is other alternative solution ?

akashdeepg12 avatar Aug 19 '17 09:08 akashdeepg12

what is the issue you are facing can you please elaborate more?

alokkarma avatar Aug 22 '17 12:08 alokkarma

html => <p-dataTable [value]="carsLarge" scrollable="true" scrollHeight="300px" [rows]="5" virtualScroll="virtualScroll" [style]="{'margin-top':'30px'}" [lazy]="true" [totalRecords]="totalRecords" (onLazyLoad)="loadCarsLazy($event)">

component => loadCarsLazy(event: LazyLoadEvent) { //for demo purposes keep loading the same dataset //in a real production application, this data should come from server by building the query with LazyLoadEvent options

   setTimeout(() => {
        if(this.datasource) {
            this.carsLarge = this.datasource.slice(event.first, (event.first + event.rows));
        }
    }, 250);
    
}

if we enable filter="true",then filtering is not working with lazy load.You can see by enable filter="true" in below demo link :=> http://plnkr.co/edit/V3JY3MASoc1Dh2pm5IJO?p=preview

akashdeepg12 avatar Aug 23 '17 09:08 akashdeepg12

You have to filter it yourself at backend in lazy mode.

cagataycivici avatar Sep 04 '17 09:09 cagataycivici

@cagataycivici I agree but how to pass column reference in the lazy load callback when user filters particular column.

Right now, when user do column search lazy load callback is called with event, how to pass column reference and search value text to the lazy load callback

mohanramphp avatar Dec 18 '17 07:12 mohanramphp