0

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.

1 Answer 1

0

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.