-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export with input Number #45
Comments
Use the onCellHtmlData option for doing this. Here is an example: https://jsfiddle.net/9kfvge22/2 <table>
<thead>
<tr>
<th>C1</th>
<th>C2</th>
<th>C3</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="number" id="r1c0"></td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>D</td>
<td>E</td>
<td>F</td>
</tr>
</tbody>
</table> use the folowing tableExport options: function DoOnCellHtmlData(cell, row, col, data) {
var result = "";
if (data != "") {
var html = $.parseHTML( data )
$.each( html, function() {
if ( typeof $(this).html() === 'undefined' )
result += $(this).text();
else if ( $(this).is("input") )
result += $('#'+$(this).attr('id')).val();
else
result += $(this).html();
});
}
return result;
}
$('table').tableExport({
type: 'txt',
onCellHtmlData: DoOnCellHtmlData}
); In case you changed the input value to 5, the result would be:
Note: The onCellHtmlData function depends on the content of the table you want to export. The DoOnCellHtmlData function shown above is just an example that meets the requirements of your question. |
Thanks a lot for the fast response. Everything you described worked fine for me. |
I have an input type=number in my table and this plugin don't export the value. Is it possible to do this?
The text was updated successfully, but these errors were encountered: