p-table inside a wrapper component

UI Components for Angular
Post Reply
rizap
Posts: 3
Joined: 21 Apr 2018, 22:16

21 Apr 2018, 22:32

Hi I'm using p-table inside my wrapper component that looks like this.
x-table.component:

Code: Select all

   <p-table>
       <ng-container ></ng-container> -----> template for the header
      <ng-container></ng-container> -----> template for the the body
   </ptable>
In other pages I call my x-table wrapper component like this:

Code: Select all

<x-table [headerTemplate]="headerTemplate " [bodyTemplate]="bodyTemplate">
   <ng-template #headerTemplate let-columns="columns">
        <tr>
          <th *ngFor="let col of columns" [pSortableColumn]="col.field"> ---> how can I access pSortableColumn from x-table?
            {{col.name}}
          </th>
        </tr>
      </ng-template>
     <ng-template #bodyTemplate let-columns="columns" let-rowData>
        <tr>
          <td>
              {{rowData.name}}
          </td>
       </tr>
    </ng-template>
</x-table>
My problem is since the p-table is inside the x-table wrapper, I cannot access [pSortableColumn] as well as the other primeng attributes (pRowToggler and etc). Do you have idea on how to access it using my wrapper component? Thanks!

User avatar
Ctrl-C
Posts: 97
Joined: 29 Sep 2016, 04:21

23 Apr 2018, 17:33

You will have to duplicate all the properties you need at your component level.

rizap
Posts: 3
Joined: 21 Apr 2018, 22:16

24 Apr 2018, 15:59

I'll try that. Thank you!

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests