API--> rows.add()

API--> rows.add()

fabiofacirfabiofacir Posts: 3Questions: 3Answers: 0

When I use this api function and the integrity of json is not correct It throws an error in "error.dt" event and breaks(destroys) the table completely.
Is that an api method to verify the json before doing rows.add() or a way of preventing table of breaking?

I'm using the following:

        $.fn.dataTable.ext.errMode = 'none';
        $('#'+this.datatable_id).on( 'error.dt', function ( e, settings, techNote, message ) {
                console.log("error:"+message);
                this.datatable.clear();
        });

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Hi @fabiofacir ,

    Yep, as you say DataTables doesn't validate - it would make the library files too large - so it's assumed the data is valid when being passed in. Try looking at this SO thread, it may help,

    Cheers,

    Colin

This discussion has been closed.