Created
November 8, 2013 15:57
-
-
Save krujos/7373160 to your computer and use it in GitHub Desktop.
ngGrid + angular dynamic cell text based off row value. I had to pad the number of rows in a ngGrid to achieve some consistency in our UI. That meant that where I was using cell templates to create links for action on a row I had to stop inserting text when we had an empty row. In order to do this I shoved an angular directive that calls a scope…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.getCellText = function(key) { | |
if ( key ) { | |
return "Do stuff"; | |
} | |
}; | |
$scope.theData = {}; | |
$scope.theGrid = { | |
data: 'theData', | |
columnDefs: | |
[ | |
{ | |
field: 'doesItHaveAValue', | |
cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()" ng-click="some_fucntion(' + | |
'row.getProperty(col.field))"><a href="">{{getCellText(row.getProperty("doesItHaveAValue"))}}</a></div>', | |
width: 80 | |
}, | |
{field:'F2', width: 150}, | |
{field:'F3', width: 100}, | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment