Get Row data in html form

Get Row data in html form

Nagma KhanNagma Khan Posts: 4Questions: 1Answers: 0

I have a DataTable i which I have created button in each row
onclick of that button the row data should be fetched in html form

Answers

  • Nagma KhanNagma Khan Posts: 4Questions: 1Answers: 0

    Reply as soon as possible

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923

    Maybe the row().node() API will do what you want.

    Kevin

  • Nagma KhanNagma Khan Posts: 4Questions: 1Answers: 0

    Thank you for a reply..
    row().node() is use to add a class
    here i need a code to get row data from DataTable and set them to html fom

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923
    edited February 2017

    Sorry misunderstood your question. Checkout this JS Bin, provided by someone else. The code provides an example of getting data from the row selected when clicking a button in that row.

    But there is a problem with the code in that when the data is loaded via ajax the buttons don't work. Discussion can be found here. Maybe you can find the answer.

    Kevin

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    There are a couple of options: row().data() would provide the data for the row. If you needed the HTML cells for the row you could use cells().nodes().

    Allan

  • Nagma KhanNagma Khan Posts: 4Questions: 1Answers: 0

    thank you all
    but that JS Bin is not working and cells().node() is used to Find cells with a jQuery contains selector and add a class and I need code to get DataTable row Data to set in html form field on click of button

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    I need code to get DataTable row Data

    row().data().

    You would need to provide a link to a test case showing the issue if you need any further help.

    Allan

This discussion has been closed.