primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Column Template Not working with Angular RC6 and beta.15

Open cbelhaffef opened this issue 10 years ago • 8 comments

Hi, I just upgraded my project to the latest Angular2 RC6 and PrimeNg beta.15 and when i add template to my column in datatable, nothing show. Also i use the : <template let-item="rowData" pTemplate type="body"> Instead of <template let-item="rowData">

Any suggestions ? somebody have the same issue.

example use case : <p-column field="name" header="Name"></p-column> <p-column styleClass="col-button" header="Delete"> <template let-item="rowData" pTemplate type="body"> <button type="button" pButton (click)="deleteItem(item)" icon="fa-trash"></button> </template> </p-column>

thanks.

cbelhaffef avatar Sep 15 '16 09:09 cbelhaffef

Do you have any errors in the console?

moxival avatar Sep 17 '16 06:09 moxival

thanks for your reply, unfortunately no, there is no errors in my console and i don't understand why.

i update to angular : 2.0.0, and primng : 1.0.0-beta-16.

no changements , I have still the same bug, no template displayed

cbelhaffef avatar Sep 19 '16 10:09 cbelhaffef

That is very strange we are using the same setup (Angular 2 final + primeng beta-16)

<p-dataTable [value]="entities" [lazy]="true" [totalRecords]="resultset.count" [responsive]="true"
             [paginator]="true" (onLazyLoad)="load($event)" [rows]="10" [filterDelay]="500"
             [rowsPerPageOptions]="[5,10,20]" sortField="name" [sortOrder]="1">
  <p-column field="id" header="#" [sortable]="true" styleClass="columnId" [filter]="true"></p-column>
  <p-column field="name" header="Name" [sortable]="true" [filter]="true"></p-column>
  <p-column styleClass="Wid10 TexAlRight">
    <template let-data="rowData" pTemplate type="body">
      <a [routerLink]="['/clients', data.id]" pButton icon="fa-eye" title="View"></a>
    </template>
  </p-column>
</p-dataTable>

The above works for us.

moxival avatar Sep 19 '16 13:09 moxival

@moxival, do we need to import something in our module to make template working. Even I am facing same issue with Angular 2 full + primeng beta 16. Ill appreciate if you can share your module imports.

rktawni avatar Sep 21 '16 10:09 rktawni

@rktawni no we don't import anything special besides DataTableModule and the modules for the comps that we use (like button etc.). Can you reproduce this in plunker or paste some code here?

moxival avatar Sep 21 '16 11:09 moxival

@moxival actually I was not using 'pTemplate' keyword which is making problem. Many thanks for your response.

rktawni avatar Sep 21 '16 11:09 rktawni

Please try with the latest PrimeNG version and comment if the issue still persists.

Mrtcndkn avatar May 05 '17 08:05 Mrtcndkn

Here is my example:

<ng-template let-data="rowData" pTemplate type="body" >
       <span>
            <a [routerLink]="['./accounts', data.TemplateId]" >
              {{data["Name"]}}
            </a>
         </span>
</ng-template>

ivanlopezmolina avatar Sep 12 '17 16:09 ivanlopezmolina