Angular 8, TurboTable: filterConstraint is not a function

UI Components for Angular
Post Reply
Posts: 5
Joined: 04 Jul 2017, 13:05

10 Sep 2019, 13:44


I was creating custom filters like this:

Code: Select all

<p-table #dt [value]="allSettings" [(selection)]="selectedSetting">
     <ng-template pTemplate="caption">
          <p-selectButton [options]="keyFilters" (onChange)="onChangeMyFunction($event, dt)"

Code: Select all

@ViewChild('dt', {static: false}) ttable: Table;

ngOnInit() {
     // This if I added in Angular 8 because this.ttable['filterConstraints'] because TypeError: Cannot set property 'containsNone' of undefined
     // In Angular 7 it was working event without this.
     if (!this.ttable['filterConstraints']) {
           this.ttable['filterConstraints'] = [];

     this.ttable['filterConstraints']['containsNone'] = function containsNone (value: string, filter: string[]): boolean {
           console.log('ttable.filterConstraints.containsNone', value, filter);
           const result = someBusinessLogic();
           return result;

onChangeMyFunction(event: any, grid: Table) {
    console.log('onChangeMyFunction() grid.filterConstraints = ', grid.filterConstraints);
    const value = event === null ? null : event.value;
    switch (value) {
    case 'none':
        grid.filter(['MONO_', 'YEXT_', 'BOOST_'], 'key', 'containsNone');
After update to Angular 8.2.5 with PrimeNG 8.0.3 (from Angular 7.2.15) I get Following error:

Code: Select all

onChangeMyFunction() grid.filterConstraints =  [containsNone: f, containsAll: f]
core.js:6014 ERROR TypeError: filterConstraint is not a function
    at Table.push../node_modules/primeng/components/table/table.js.Table._filter (table.js:887)
    at table.js:830
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Object.onInvokeTask (core.js:39679)
    at ZoneDelegate.invokeTask (zone-evergreen.js:390)
    at Zone.runTask (zone-evergreen.js:168)
    at invokeTask (zone-evergreen.js:465)
    at ZoneTask.invoke (zone-evergreen.js:454)
    at timer (zone-evergreen.js:2650)
What should I do? Why is property this.ttable['filterConstraints'] undefined by default? Shouldn't there be something like "contains", "gt" and so on?

Thank you very much for your support!


Posts: 8
Joined: 25 Jul 2018, 15:16

17 Oct 2019, 16:13

I'm also having issues with this after upgrading to primeng 8.0.4

I would like to upgrade to have the latest fixes in place, although I was using this property to define date range filtering on the tables. It's weird that we no longer have this option to create custom filters, specially when there a couple of simple scenarios that are not supported out of the box (date range).

Was this change intentional? Is there any other way to define custom filters?

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: Filippo and 3 guests