cannot read property 'filter' of undefined

Post Reply
fiyazhasan
Posts: 2
Joined: 28 May 2017, 11:51

30 May 2017, 11:22

Hi, I have a basic licence for morphus. I have to implement the slider filter for coulmns value. So I followed this https://www.primefaces.org/primeng/#/datatable/filter and implemented filter but its showing me this error when I try to move the slider:

Code: Select all

ERROR TypeError: Cannot read property 'filter' of undefined
    at Object.eval [as handleEvent] (ItemMaintComponent.html:86)
    at handleEvent
Here is my code:

Code: Select all

<p-column field="sellingPrice" header="Selling Price ({{sellingPriceFilter||'No Filter'}})" [filter]="true" filterMatchMode="equals">
                    <ng-template pTemplate="filter" let-col>
                        <i class="fa fa-close" (click)="sellingPriceFilter=null;dt.filter(null,col.field,col.filterMatchMode)"></i>
                        <p-slider [style]="{'width':'100%','margin-top':'8px'}" [(ngModel)]="sellingPriceFilter" [min]="11000" [max]="115000" (onSlideEnd)="dt.filter($event.value,col.field,col.filterMatchMode)"></p-slider>
                    </ng-template>
                </p-column>

fiyazhasan
Posts: 2
Joined: 28 May 2017, 11:51

30 May 2017, 18:45

ok found it! you have to add the #dt in the p-dataTable component in order to refer it when you use filtering on the datatable.

Code: Select all

<p-dataTable #dt>

User avatar
aragorn
Posts: 3465
Joined: 29 Jun 2013, 12:38

13 Jun 2017, 10:10

Glad to hear, thanks for the update!

Post Reply

Return to “Morpheus - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest