row().remove in "createdRow"

row().remove in "createdRow"

ramtamtamramtamtam Posts: 4Questions: 2Answers: 0

Hi everybody,

i have to remove single rows where a column = 0. I tried this with "createdRow"-Option but it didn't work. Any suggestions?

var t_dashboard_heute = $('#t_dashboard_heute').DataTable({
        "destroy": true,
        "processing": true,
        "ajax": "../sources/t_dashboard_data_heute.php",
        "order": [[1, "asc"]],
        "createdRow": function(row,data,dataIndex){
            console.log(data[2]);
            if ( data[2] == 0 ) {
                $(row).remove();
            }
        }
    });

Thanks
André

Answers

  • ramtamtamramtamtam Posts: 4Questions: 2Answers: 0

    Found a solution.

    "createdRow": function(row,data,dataIndex){
                console.log(data[2]);
                if ( data[2] == 0 ) {
                    t_dashboard_heute.rows($(row)).remove();
                }
            }
    
  • allanallan Posts: 64,032Questions: 1Answers: 10,555 Site admin

    You need to use a filter. In this case a custom filter is probably the best way.

    Allan

This discussion has been closed.