Excel export problem

Excel export problem

kreso191kreso191 Posts: 5Questions: 5Answers: 0

I have DataTable in which some columns have input fields. I want Excel document to contains what is written in the input field. The first thing I do when I get some data from database is this:
result[5] = '<label id="ld' + result[13] + '" hidden>' + result[5] + '</label><input id="l' + result[13] + '" class="nova_sifra" value="' + result[5] + '" ' + dis + '/>';

After the table is generated it will export everything in excel (without this label element it won't export data from input in excel) When I change data in the input field I trigger onChange event that changes the text in the label, but the thing is that the exported excel document doesn't contain changes.

I assume that I need something like $("#ukupna").cell($("[id='"+id2+"']").parent()).data(new_data).draw(); but this isn't working.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,320Questions: 26Answers: 4,773
    Answer ✓

    Try:
    $("#ukupna").DataTable().cell($("[id='"+id2+"']").parent()).data(new_data).draw();

    Assuming your selector of $("[id='"+id2+"']").parent() is correct then that should work. Otherwise you will need to use something like cell().invalidate() to have Datatables update its data if you update the HRML directly.

    Kevin

This discussion has been closed.