Adding data attributes depending on ajax data
Adding data attributes depending on ajax data

Hello.
I want to pass a data to my Datatable with structure like this
[{mainValue: 1, additionalValue: 'one'}, {mainValue: 2, additionalValue: 'two'}... and so on]
and then in resulting table get a cells in format like this (adding main value as text inside a cell and second value as data-attribute):
<td data-value="one">1</td>
<td data-value="two">2</td>
I know. that I can export 'mainValue' by columns.data option but how can I adding data-attribute with additional value?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
You could do that within
createdRow
,Colin
Thank you, that's really help me.
But now Im struck with another problem.
Im trying to use Scroller extension with colReorder plus I have a createdRow function like that:
It works fine until I'm trying to reorder some column and fetch new data from ajax.
Function bound to index in array and if I change it - it starts to add attribute to incorrect column.
Is there any way to get new order of columns and map it to object keys?
There's a lot going on there. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin