Composing a custom column

Composing a custom column

mhamdymhamdy Posts: 1Questions: 1Answers: 0
edited July 2016 in Free community support

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

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    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

This discussion has been closed.