Remove child row button if data is null

Remove child row button if data is null

kerblooykerblooy Posts: 3Questions: 1Answers: 0

So basically, I'm using this:
https://datatables.net/examples/api/row_details.html

My table has a button that shows a child row and displays data.
However, not every row has data for a child row!
Is there a way I can not show a button if the data is null?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,091Questions: 1Answers: 10,181 Site admin
    Answer ✓

    Yes - rather than using columns.className to just apply the details-control class to all cells in that column, you could use createdRow to selectively add it based on the row's data.

    Allan

  • kerblooykerblooy Posts: 3Questions: 1Answers: 0
    edited July 2017

    Wow, thank you very much! It's hard to think that it was that easy!

    I can see why you have 5k+ answers!

    Thanks again :)

  • allanallan Posts: 62,091Questions: 1Answers: 10,181 Site admin

    Wish I'd had the answer's thing from the start - only enabled it a few years back :).

    Good to hear its working for you now!

    Allan

This discussion has been closed.