Export Data with text box in TD of data table ?
Export Data with text box in TD of data table ?
m_arslanahmad@yahoo.com
Posts: 1Questions: 1Answers: 0
[Urgent] I have data table with Run time editable td like
<td> <input type="text" value = "DynamicValue" > </td>
But i am exporting this i have an issue that td's with having textboxes are not showing data in excel ? if anyone have an idea or have code please share ????
This discussion has been closed.
Answers
try this https://datatables.net/extensions/buttons/examples/html5/index.html
I don't think there is a way around this at the moment.
The issue is that the value of the
input
element is a DOM property, while the export is reading from the stored data for the table (i.e. the string<input ...>
) not the DOM element. It can be forced to use the DOM, but not a DOM property.It might be possible to use the
customize
callback, but I don't think it will be easy.I'll have a think about the options for this.
Allan
Below worked for me
$("#mytable").dataTable( {
"pageLength": pageSize,
dom: domVal,
"buttons": [
{extend:'excel',exportOptions: {format: {
body: function ( data, row, column, node ) {
//
//check if type is input using jquery
return $(data).is("input") ?
$(data).val():
data;
}
}
}}
, {extend:'pdf'}
]} );
Couldnt delete post, sorry, I'll start a new question thread since I saw this marked as answered
Hi,
ahmadshakil's solutions doesnt work for me, it ends up exporting all html in the cell.
Is it because I both have divs wrapping the input?
A solution is much appreciated!
Task: Export the entered value from input type text.
That post was made and answered here.
Allan