How to export render value
How to export render value
test42
Posts: 21Questions: 8Answers: 0
Hi,
I've rendered a dropdown into my datatables so the user can select a value. When I go to export that with excel, it outputs the two dropdown values together. How can I make it so it outputs what the user selects?
Thanks!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to use a custom export formatting function. In that you will have access to the original node, so you can query its DOM and return the selected value.
Allan
Got it, thanks Allan!
The only question I have left is if we're rendering the data client side, can we still use any of the API commands to pull the cell data or do we have to query each cell using jQuery to get the value? And if that's the case would we have to leverage the row and column parameters to loop through each row to pull the correct cell?
The formatting function has the
node
passed in, so if for example you wanted to get a selected value you might use:$('option', node).is(':selected')
. You could do it without jQuery as well if you prefer.Allan
Excellent, got it working, thanks again!