[FIXED] How to add frozen columns to primeNG when rows are rendering dynamically in Angular

Issue

I was looking for help to add the frozen columns feature in my primeng table where the columns and rows are dynamically rendered.

I do have a config( isPK: true) that came from data on which I want to make frozen columns.

I have tried following stackblitz but I cannot found a solution to match the example given in the documentation of PrimeNG

Thanks, @Owen for the answer but now If I try to add an extra column in the HTML itself it is getting doubled like this,

https://stackblitz.com/edit/primeng-tablescroll-demo-jvmrfs
enter image description here

Solution

You should use templating for frozen data as described in documentation in Templates section:

frozenheader: Content of the thead element in frozen side.

frozenbody: Content of the tbody element in frozen side.

Here is a working example. Table body looks weird but because you are using dynamic columns, there must be a match between columns and data.

Like this example for Dynamic columns from documentation.

Answered By – georgeos

Answer Checked By – Laura B. (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published