Datatable removing plus icon if childrow has no data

Datatable removing plus icon if childrow has no data

afsal9afsal9 Posts: 1Questions: 1Answers: 0

How can i remove the plus icon from the parent row if child row has no data to show.
in the below example i could not find any options.
https://datatables.net/examples/api/row_details.html

I want to show plus icon only if child has data. can i archive this using initComplete function
thanks

Answers

  • southfanningsouthfanning Posts: 8Questions: 1Answers: 0

    I'm trying to do the same thing. Did you have any luck? I'm trying to remove the column class for those rows that don't have child data.

  • southfanningsouthfanning Posts: 8Questions: 1Answers: 0

    Here's how I did it. It's probably not the most elegant, but it's working. Basically I ran through the rows after the table had been drawn, and I removed the control class from that first td for any rows that didn't have any child data.

    my Table is oTable, and my controls class that sets the image is dh-dtbl-details-control

    oTable.rows().data().each(function(value, index, id) {
        var node = oTable.row(index).node();
    
        if (value.container_cnt === 0){
            $(node).find("td.dh-dtbl-details-control").removeClass("dh-dtbl-details-control");
        }
    
This discussion has been closed.