如何在ui-grid cellTemplate中显示数据时添加条件样式:我想将mofify格式显示为链接或没有链接。 与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
]
};
预期结果应该是名称是基于参数链接的链接或文本
提前致谢。
答案 0 :(得分:0)
我制作了条件模板:
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