gdepourtales / ng-cells

AngularJS Table directive that draws a table of data with different features
http://gdepourtales.github.io/ng-cells/
Other
77 stars 17 forks source link

Features/custom cell template #7

Closed kayhadrin closed 10 years ago

kayhadrin commented 10 years ago

Here's a new feature to make ng-cells able to use custom angular templates in each cell.

Now I know that it's not good to do this for the whole grid, but I still find myself in a scenario where we have to make action buttons on the side of a table. So in my opinion, this new feature really helps to keep things tidy and extensible.

Documentation

When defined on a range custom-cell-template Render a custom Angular template in the cell instead of using custom-html-fn.
Accepts types: * string: URL of an Angular template. E.g. custom-cell-template="'template.html'" * Function: function that returns the URL of an Angular template. E.g. custom-cell-template="getTemplate"
Function signature is function(rawData, row, col, formattedValue, scope) where rawData is an object that describes the table cell. rawData.data points to the actual cell value.
Note: The cell value is stored in scopeExtension.rawCellData and can be accessed in the Angular template as follow: <span style="color: red">{{scopeExtension.rawCellData.data}}</span>.
See test case ./test/custom-cell-template.html for a full example.

gdepourtales commented 10 years ago

Hi. Thanks a lot. This new feature is really cool ! And sorry for the delay for merging it.

kayhadrin commented 10 years ago

No worries. I'm glad you find it useful :-)