row.remove() and write the selected row to another tabbed table

row.remove() and write the selected row to another tabbed table

zgoforthzgoforth Posts: 493Questions: 98Answers: 2

Link to test case: https://jsfiddle.net/BeerusDev/5nLg4bt0/171/

Hello,

I have tried to create a tabbed DataTable, but 1) the tabs aren't working like they should. 2.) My select option isn't working. I can select the row and click on the "Mark Task as Complete" and it will delete the item in the DataTable. What I am trying to do is have it save as a rowNode then remove from table and draw it to completedTable. But I am getting a script error

Uncaught TypeError: Cannot read property 'nodeName' of null

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974
    edited August 2021

    It looks like you are removing the selected row. Then trying to retrieve the selected row. You should first get the selected row, add it to the other table then remove it. Something like this:

        $('#button').click( function () {
            var data = table.row('.selected').data();
    
        completedTable
            .row.add( data )
            .draw();
    
            table.row('.selected').remove().draw( false );
        } );
    

    Also you will want to define columns.data for the second table.

    Kevin

Sign In or Register to comment.