Drop down selected only

Drop down selected only

sandro33sandro33 Posts: 5Questions: 2Answers: 0

Hi,

i have a mysql/php table with drop down select.
I want to export the table in csv but when i do it all options of my drop downs select appear. i just want the option "selected" in the export.
How it's possible ?

Thanks

Sandro

Answers

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin

    You would need to provide a custom formatting function like in this example.

    The problem is caused by the fact that the export uses $().text() to get the data to export, so it basically just strips the HTML. In your case you'd need to provide a function that will get the text value of the selected option element only.

    Allan

  • bhaskarsrinivasbhaskarsrinivas Posts: 1Questions: 0Answers: 0

    when drop down on change , data table is appearing but when page refresh it display all data how to save drop down selected value

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin

    You could use DataTables state saving options. stateSaveParams and stateLoadParams are probably the two options you want to look into.

    Allan

This discussion has been closed.