user3257755 user3257755 - 3 months ago 73
HTML Question

How to clear dynatable and add new data?

I'm working with a dynatable in javascript that I want to clear and add new data to.

This is the code for initializing the dynatable:

$('#my-final-table').dynatable({
dataset: {
records: recordArray,
},


However, this doesn't work when the dynatable is already created. If so, nothing happens.

How can this be solved?

Answer

My code:

     response = $.parseJSON(data);

            var dynatable = $('#printIDs').dynatable({
                dataset : {
                    records : response
                }
            }).data('dynatable');

             dynatable.settings.dataset.originalRecords = response;
             dynatable.process();