Datatable updating large table's CELL data with id is taking long and unresponsive

Datatable updating large table's CELL data with id is taking long and unresponsive

KushalJainKushalJain Posts: 2Questions: 1Answers: 0
edited May 2018 in Free community support

The table with 6000 rows, and each need to Async update of selected CELL with new data.

Currently logic used :

var oDataTable = $("#datatable").DataTable ();

oDataTable.cells().every( function () 
{   
    var node = this.node ();
    var oId = node.id;

    if (oId <check>) //if id equals to some value, update the cell with new data
    {
        oDataTable.cell(node).data (<newData>);
    }
});

oDataTable.draw ();

P.S : I need the rows which have are not being updated also, so all the rows should be there and out of 6000+ rows few cell data needs to be updated and sorted with latest update on top.

Appreciate for the help and time. :smile:

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    Hi @KushalJain ,

    Yep, that's one way to do it. You could also clear down the table with clear() and just reload the rows with rows.add().

    Cheers,

    Colin

  • KushalJainKushalJain Posts: 2Questions: 1Answers: 0

    Hey @colin ,

    Thanks for the replay, but Clear will delete all the rows in the table correct, but I dont want to remove all the rows I want all the rows as it is but update few columns in few rows.

    Thanks,

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    Hi @KushalJain ,

    If you just want to change the data in a row, you can easily do that with something like this:

    table.row(rowId).data(yourNewData).draw();
    

    Cheers,

    Colin

This discussion has been closed.