JQuery Datatable reload - version 1.10.0

JQuery Datatable reload - version 1.10.0

brkbrk Posts: 3Questions: 3Answers: 0
edited November 2014 in Free community support

I'm trying to reload datatable. I click a cell and then an ajax request works. If it returns success, I need to reload the datatable with new data. I can see reload action "Processing" but new data doesn't seen in the table.

I'm using the same function in deleting process and it works.

Here is my code sample;

var dataTableId = "#dataTable";

function deleteFunction(){

// works correctly

}

$(dataTableId).dataTable({
"sAjaxSource": "url",
"aoColumns": [
...
],
"aoColumnDefs": [
...
]
});

var table = $(dataTableId).DataTable();
$('#dataTableFiles tbody').on('click', 'td', function () {

             $.ajax({
                url: "url",
                type: 'post',
                dataType: 'json',
                data: postArray,
                success: function (response) {
                    if (response.result) {
                        table.ajax.reload();
                    }
                    else {
                        table.ajax.reload();
                    }
                },
                error: function () {
                    console.log("err")
                }
            });    
});

Thank you..

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Can you link tp the page showing the issue please?

    Allan

This discussion has been closed.