How to capture p-dataview filtered event

UI Components for Angular
Post Reply
nazzamazzit
Posts: 1
Joined: 21 Jun 2021, 14:27

21 Jun 2021, 14:33

Hello!

I'm italian, I manage a basic english.
I need to know how to capture the filtered event of a p-dataview element, that is, do something just when this.dataview.filter() has finished its work! Can anyone help me?

PhilHuhn
Posts: 177
Joined: 19 Sep 2018, 02:52
Location: Ann Arbor, Michigan USA
Contact:

21 Jun 2021, 21:15

Ciao:
I replaced the filter method with my method, then I called the DataView's method from my method as follows:

Code: Select all

 (input)="Myfilter($event.target.value)"
As seen below:

Code: Select all

<div class="card">
  <p-dataView #dv [value]="products" [paginator]="true" [rows]="9" filterBy="name"
      [sortField]="sortField" [sortOrder]="sortOrder" layout="grid">
      <ng-template pTemplate="header">
          <div class="p-d-flex p-flex-column p-flex-md-row p-jc-md-between">
              <p-dropdown [options]="sortOptions" [(ngModel)]="sortKey" placeholder="Sort By Price" (onChange)="onSortChange($event)" styleClass="p-mb-2 p-mb-md-0"></p-dropdown>
              <span class="p-input-icon-left p-mb-2 p-mb-md-0">
                  <i class="pi pi-search"></i>
                  <input type="search" pInputText placeholder="Search by Name" (input)="Myfilter($event.target.value)">
              </span>
              <p-dataViewLayoutOptions></p-dataViewLayoutOptions>
          </div>
      </ng-template>
Then in typescript:

Code: Select all

import { DataView } from 'primeng/dataview';
...
    @ViewChild( 'dv' ) dv: DataView;
    ...

    Myfilter(filter: string, filterMatchMode:string = "contains" ) {
        this.dv.filter( filter, filterMatchMode );
        // free to do anything here
    }

citoukelr
Posts: 2
Joined: 15 Jun 2021, 23:33

11 Jul 2021, 00:11

Is there a DataView equivalent for IList? I had a DataTable that fed into several filtered DataViews which fed into several DataGridViews. After getting everything working, come to find out DataTables are 20 year old technology that shouldnt be 192.168.100.1 192.168.1.1 used.

PhilHuhn
Posts: 177
Joined: 19 Sep 2018, 02:52
Location: Ann Arbor, Michigan USA
Contact:

15 Jul 2021, 21:03

Hey,

Try
VirtualScroller is an efficient way of rendering lists by displaying a small subset of data in the viewport at any time.
https://www.primefaces.org/primeng/show ... alscroller

It also supports lazy.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests