Composing a custom column
Composing a custom column
So I have an array of data that won't be displayed directly in the data table. I need to compose a column data using multiple fields in the data [data.json]. I also need to modify the display options using data on server [display-options.json].
A plunk is worth more than a thousand words: plunkr
The second column shows as [Object object] and the withRender() function is not being called.
Bonus Question: any advice on how to unit test data tables using jasmine/karma?
There's an unanswered question here on SO.
I can at least cause the datatable directive to load by using the $compile service:
$compile('<table datatable="" dt-columns="dtColumns"></table>')($scope)
But it goes no further probably because of absent table HTML.
Answers
Using a rendering function is absolutely the correct way to approach this. However, I'm afraid I can't say why it isn't being called in this case. I'm not particularly familiar with the Angular-DataTables code as it wasn't written by myself. You'd probably need to ask them why that isn't adding the renderer.
Allan