Page 1 of 1

cannot read property 'filter' of undefined

Posted: 30 May 2017, 11:22
by fiyazhasan
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>

Re: cannot read property 'filter' of undefined

Posted: 30 May 2017, 18:45
by fiyazhasan
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>

Re: cannot read property 'filter' of undefined

Posted: 13 Jun 2017, 10:10
by aragorn
Glad to hear, thanks for the update!