Column Template Not working with Angular RC6 and beta.15
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.
Do you have any errors in the console?
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
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, 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 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 actually I was not using 'pTemplate' keyword which is making problem. Many thanks for your response.
Please try with the latest PrimeNG version and comment if the issue still persists.
Here is my example:
<ng-template let-data="rowData" pTemplate type="body" >
<span>
<a [routerLink]="['./accounts', data.TemplateId]" >
{{data["Name"]}}
</a>
</span>
</ng-template>