html5csv
html5csv copied to clipboard
export selected in dropdown
Hi, can you add it to csv when the element is a dropdown and only select the selected option in the dropdown?
Is it possible?
Thanks!
Do you have user input and select elements inside a table, and you want to capture the inputs from the user?
This could be accomplished by modifying the fromTable
function at about line 298 of https://github.com/DrPaulBrewer/html5csv/blob/master/html5csv.js
At this point the table cell is being processed. Now it obtains the text of table cell with item=$(this).text()
. But it is possible to use $(this).find('select')
or $(this).find('input')
at this point to detect any select or input elements inside the cell. Any additional code needs to be separated into if-else
blocks depending on whether the table cell contains text, an input element, or a select box.
This doesn't seem too difficult. If you want to write it and send me a pull request, I think a solution would get the "val" of <input ...>
elements and the selected element from a <select>
If you don't know jQuery, I may eventually write it. It sounds like a useful feature.
I've managed to implement this on datatables nevertheless I'll add it here
Thanks!
Sounds good.