Adding data-* to

Adding data-* to

nhughes552nhughes552 Posts: 7Questions: 2Answers: 0

Hi

Anyone have an example of how to add data-* Attributes to <td> elements?

Thanks

Nige

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,139Questions: 26Answers: 4,735
    edited October 2017

    There are a couple examples found in the Examples page under Advanced. Is this what you are looking for

    Kevin

  • nhughes552nhughes552 Posts: 7Questions: 2Answers: 0

    Hi

    Thanks for the quick response.

    Looked at the example and it mentions it can detect four different attributes but as far as I can see the example does't show how to set them.

    I would like to be able to add custom data-* attributes. There is a mention about using the columns.render (https://datatables.net//forums/discussion/comment/74121/#Comment_74121) but again not really a specific example and I'm still a bit of a novice!

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394

    The examples are shown in the HTML - look under the HTML tab on the examples page.

  • nhughes552nhughes552 Posts: 7Questions: 2Answers: 0

    Ah I see in the example the table is created and **then **enhanced by datatables. I'm using ajax and datatables to create the table and want to add the attributes as datatables creates the table.

  • allanallan Posts: 61,433Questions: 1Answers: 10,049 Site admin
    Answer ✓
This discussion has been closed.