Search code examples
primengprimeng-datatable

How to get the filtered value of a column in primeng datatable?


I have a datatable with 10 columns. on change of filter value in a column i have to display the alert message with the filtered value.

 <p-dataTable #dt [value]="jobslist" [rows]="30" [paginator]="true" [rowsPerPageOptions]="[30,50,75]" sortMode="multiple" scrollable="true"   resizableColumns="true" scrollHeight="350px">
  <p-column [style]="{'width':'70px'}" field="org" header ="Org" [sortable]="true" [filter]="true"></p-column>
</p-datatable>

If the user enters Org 2 in the filter , it should display "You have selected Org 2". Can anyone please let me know how to do that ?


Solution

  • //CAN'T COMMENT YET SO I AM GOING TO POST

    Did you try (onFilter) function that PrimeNG DataTable has? The function takes in the filtering event and there is also event.filtered (as stated on Prime documentation) so you might want to try that approach.