Reputation: 101
How to add conditional styling when showing data in ui-grid cellTemplate below: I want to mofify format to be shown as link or no link. Similar to Conditional cell template in ui-grid angularjs.
var myTemplate = '<div>{{getExternalScopes().showName(row.entity)}}</div>'
$scope.gridOptions = {
columnDefs: [
{ field: 'code' },
{ field: 'name', cellTemplate: myTemplate},
// field 'link
]
};
The expected result should be that name is link or text based on parameter link
Thanks in advance.
Upvotes: 0
Views: 3533
Reputation: 101
I made conditional template:
cellContainerNameLinkTemplate:
'
<div class="ui-grid-cell-contents"
ng-if = "row.entity.IsSample"
ng-class = "col.colIndex()">
<div class = "gridnolinkpointer"> {{grid.getCellValue(row, col)}}</div>
</div>
<div ng-if = "!row.entity.IsSample">
<div class = "nav nav-pills" ng-class = "col.colIndex()" >
<a class = "gridlinkpointer" ng-click = "getExternalScopes().followlink({event:$event,row:row})">
{{grid.getCellValue(row, col)}}</a>
</div>
</div>
', cellW
Upvotes: 0