angularjs - Angular JS: How to use icons in the ng-grid grouping columns? -
is there way display icons instead of text in ng-grid grouping columns?
update 04-14-2015
i did it! making example in plunker, wanted. thank all.
$scope.gridoptions = { ... aggregatetemplate: aggregaterowtemplate() }; function aggregaterowtemplate() { var result = "<div ng-click=\"row.toggleexpand()\" ng-style=\"rowstyle(row)\" class=\"ngaggregate\">" + " <img ng-src='{{row.label}}' lazy-src >" + " <div class=\"{{row.aggclass()}}\"></div>" + "</div>" return result; }
plunker: http://plnkr.co/edit/oxvcvgmjgzgsnl1eov1d?p=preview
use columndefs, stated in docs, celltemplate allows give html string display within column cells.
an example using bootstrap glyphicons:
$scope.gridoptions = { data: [{name: "line 1", icon: "plus"}, {name: "line 2", icon: "trash"} }], columndefs: [ {field: 'name', displayname: 'name'}, { field:'icon', displayname:'icon', celltemplate: '<div><i class="ngcelltext" ng-class="glyphicon glyphicon-{{ row.getproperty(col.field) }}"></i></div>' } ] };
Comments
Post a Comment