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!


Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests