I have a Kendo grid with hyperlink to cell values as below,
on clicking the hyperlink it routes to different page, based on different scenarios
<kendo-grid-column title="Test3" field="testCount"
[minResizableWidth]="30" [width]='gridColumnWidth' [filterable]="false" [sortable]="false">
<ng-template kendoGridCellTemplate let-dataItem>
<a href="javascript:void(0)"
(click)="goToPage(test3)"
>
{{dataItem.testCount}}</a>
</ng-template>
</kendo-grid-column>
How can I avoid the hyperlink on the cell with count as zero, since it directs to no data grid in another page.
CodePudding user response:
Us an ngIf to conditionally show the anchor tag:
<a *ngIf="dataItem.testCount > 0; else noHyperlink"
href="javascript:void(0)"
(click)="goToPage(test3)"
>
{{dataItem.testCount}}</a>
<ng-template #noHyperlink>0</ng-template>