how to get a value from an HTML input tag for csv/copy/excel buttons?

how to get a value from an HTML input tag for csv/copy/excel buttons?

kdubskdubs Posts: 13Questions: 5Answers: 0

I've got a table that uses HTML input tags. it displays great and works fine. I did make a custom sort, and that was straight forward. I haven't been to figure out how to get the value when using the cva/copy/excel buttons. Is there a straight forward method to access the value of the input tag?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,722Questions: 26Answers: 5,027
    edited February 28

    I would look at using orthogonal data like this example. Possibly you can use exportOptions: { orthogonal: 'sort' } depending on what you are doing there.

    If you still need help then please provide a simple test case showing an example of your data and what you are doing to handle sorting. Then we can offer more specific suggestions.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • kdubskdubs Posts: 13Questions: 5Answers: 0

    the excel/cvs/copy buttons appear to extract the data with the display option under the orthogonal data. so that does not help.

    I'll throw together an example, but the questions seem straight forward. how do you extract the value from an HtML input tag using the copy/csv/excel buttons?

  • allanallan Posts: 64,059Questions: 1Answers: 10,559 Site admin
    Answer ✓

    You need to use an export formatting function, as shown in this example. That example doesn't use input elements, but it does show the use of a formatting function. Note in particular the 4th parameter passed to the function is a node - you'd query that to get the input and then read the value from that element.

    Allan

  • kthorngrenkthorngren Posts: 21,722Questions: 26Answers: 5,027
    edited February 28

    but the questions seem straight forward. how do you extract the value from an HtML input tag using the copy/csv/excel buttons?

    Here is an example of using the sort orthogonal data to export the input values:
    https://live.datatables.net/cecugaqi/1/edit

    However if you are doing some like Live DOM ordering then using the sort orthogonal won't work.

    Each solution is different which is why I asked for a simple test case to see what you are doing and how you are handling sorting the input values. Allan's example is probably best to access the node.

    Kevin

  • kdubskdubs Posts: 13Questions: 5Answers: 0

    allan's example is what I need.

    I realize I'm having trouble reading the documentation. working backwards from this example I can now see in the documentation that exportOptions takes format which takes body which takes a function.

    thanks for your help. this code is very flexible and extensible which is both a blessing (cuz is does everything) and a curse ( cuz the manual is so big) ... 8- )

Sign In or Register to comment.