Is it possible to remove a row or possible hide it, if a Cell content is empty?

Is it possible to remove a row or possible hide it, if a Cell content is empty?

eivleivl Posts: 2Questions: 1Answers: 0

I know how to delete a row by clicking on it, but is it possible to iterate over the whole table and remove all rows where the content is empty or maybe if a cell has a specific class name?

I am not sure where to start, should i check row.child().hasClass() to do this or something else?

Answers

  • eivleivl Posts: 2Questions: 1Answers: 0

    Found a solution that works with removing row. if anyone knows how to hide it and be able to toggle back on farward that would help even more ;)

    table.cells().every( function () {
    if ( this.data() === '' || this.data() === null) {
    $(this.node()).parent('tr').addClass( 'empty' );
    }
    } );

This discussion has been closed.