Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to freeze columns in PrimeNg data table - Angular 2?

In PrimeNg data table , is it possible to freeze first few columns and have horizontal scroll-x for the rest ? I want exactly similar to this :

https://datatables.net/extensions/fixedcolumns/examples/initialisation/two_columns.html

like image 945
Kannan M Avatar asked Nov 09 '22 11:11

Kannan M


1 Answers

<p-dataTable [value]="..yoursource" [frozenWidth]="Set your frozen width in px" [unfrozenWidth]="Set your un frozen width in px">

    -- frozen column
    <p-column [header]="" [frozen]="true">
      <template>                      
      </template>
    </p-column>

   --unfrozen column
    <p-column>
    <p-column>

</p-dataTable>
like image 74
Kannan M Avatar answered Nov 15 '22 08:11

Kannan M