Export values typed in input box (excelHtml5)
Export values typed in input box (excelHtml5)
Hi,
I've searched and tried getting this fixed for some hours now, but cannot get it to work.
The cell consists of some div's wrapped around an input type text, and I need to only get the typed value from this input exported to excel.
Any help is much appreciated
This discussion has been closed.
Answers
Can you post a link to an example with your data and code?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Yes... but cant I do that if someone first provide an idea/solution for this which wouldnt work?
The point is for you to at least start an example that has an example of your data and maybe some code you've tried. Otherwise we would be guessing as to what you have. At a minimum please build a Datatable that represents your data.
Kevin
If it helps this will give you a base to start from with an Excel export button. Just take one of the columns and create the inputs as you normally have them. Add some code to the export button if you wish.
http://live.datatables.net/vuqarogu/1/edit
Kevin
Hi again,
Yes sorry didn't mean to be lazy.....
Find it here:
http://live.datatables.net/vanalove/1/
You need to use a
body
export function if you want to get data from a "live" element such as aninput
. That will give you access to the DOM element so you can query it directly for its value.Allan
Oh sorry - there is an example of using a formatting function available here.
Allan
Thanks,
Are you refering to the example where ”$” is stripped from cell/value?
So I will need to use regex to extract the value from all the HTML?
I think what you need to do is use the example you posted to here:
https://datatables.net/forums/discussion/42205/export-data-with-text-box-in-td-of-data-table#latest
You will need to workout the selector to use to get to the input element. You can use some console.log() output to see how to drill down the nested
div
tags to get the input value.Kevin
Thanks for the ideas
Do you guys have any suggestions on how to do that?
When I use the above code this gets exported into the excel file
<div class='form-inline'><div class='form-group'><input type='text' class='form-control input-sm addField' style='height:23px; width:45px;' value='22'></div></div>
I've tried useing class name, return $(data).is("input.addField")
I solved it by modifying the above example.
Thank you for guidance
Hi.. Please Help..
The above code doesn't work for me..
I want to export the date entered in the textbox available in the datatable to Excel.
the above comments helped me put it together; my input was of type submit and it was inside forms tag,my column was second in so had index 1 :
the whole code:
This is whole code that actually works for me:
This worked for me:
Mine is input type submit inside forms tag;