OnChange event to PInputText in DataTable

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
China Steel
Posts: 5
Joined: 19 Aug 2017, 09:06

27 Dec 2017, 13:58

I want to implement pTemplate="filter" for text box, Below is my code which is not working as expected.

<p-column field="title" header="Title" sortable="true"
[filter]="true" filterMatchMode="contains">
<ng-template pTemplate="filter" let-title>
<input type="text" pInputText [(ngModel)]="titleFilter"
(onChange)="dt.filter($event.value, title.field, title.filterMatchMode)" styleClass="ui-column-filter"/>
</ng-template>

<ng-template let-issue="rowData" pTemplate="body">
<div>
{{issue.title}}
</div>
</ng-template>
</p-column>

According to PInputText document, OnChange event is not supported, but for filter in DataTable we must have OnChange event on element.
How can i achieve this?

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

04 Jan 2018, 09:20

Can you create a plunker example (http://plnkr.co/edit/6q5v84DWolH6DeAdi70w?p=preview)?

saiediitm
Posts: 2
Joined: 12 Mar 2019, 17:16

14 Mar 2019, 17:25

You may want to look at this https://stackoverflow.com/questions/448 ... in-angular . I was able to solve the issue using

Code: Select all

// ngModelChange

// Something like this

<input type="text" [(ngModel)]="rowData.time" (ngModelChange)="onTimeChange(rowData)" [disabled]="rowData.disableTime">

Post Reply

Return to “Atlantis - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest