Primeng: Turbo Table global filter issue

Created on 19 Jan 2018  路  6Comments  路  Source: primefaces/primeng

The global filter throws error on input.
Throws length of undefined error in line 575 in the component js file.
My table template is:









{{'companies.management.Name' | translate}}
{{'companies.management.Users' | translate}}






{{company.id}}
{{company.name}}
{{company.applicationUsers}}





(Count: {{rowCount}})

All 6 comments

I am getting same problem.
I am using firebase firestore to get data.
I fill the table without any problem.
But global filter throws error:

ERROR TypeError: Cannot read property 'length' of undefined at Table._filter (table.js:575) at Table.filter (table.js:540) at Table.filterGlobal (table.js:550) at Object.eval [as handleEvent] (UsersComponent.html:11) at handleEvent (core.js:13540) at callWithDebugContext (core.js:15049) at Object.debugHandleEvent [as handleEvent] (core.js:14636) at dispatchEvent (core.js:9955) at eval (core.js:10580) at HTMLInputElement.eval (platform-browser.js:2628)

Edit:
Btw. I am creating table manually. I define columns manually.

It is confusing, was having the same issue. You need to define the column dictionary and assign to [columns] on the p-table like the example. The global filter uses this.columns to figure out the columns to filter on. Without that defined will get that error.

@bias-keenly you are right. I've just created table dynamically and it works. both global and normal filtering works when table is created dynamically.

When I tried to add cols to the manually created table, it didn't throw the previous error but filtering didnt work right...

Maybe related to this #4885

For a temp workaround I set [lazy]="false"

I ran into a similar issue, but resolve it by setting appropriate field and add to template body.

Global filtering works if you set [columns]="cols" where
this.cols=[ {field: "col1-field", header:"col1-header"}]

Only col1-field is searchable. You need to specify "columns" in your pTemplate="body". For example,

Was this page helpful?
0 / 5 - 0 ratings