Update and Redraw Single Row Only
Update and Redraw Single Row Only
mrtomd
Posts: 4Questions: 2Answers: 0
I want to update the data for a single row. I don't want the entire table to redraw because it takes the person away from where they were, making it hard to work on subsequent rows back to back to back.
I grab the data for the row, manipulate one cell, and then redraw.
var temp = table.row(5).data();
temp[0] = 'Tom';
table.row(5).data(temp).draw();
This redraws the entire table. Is there a way to just redraw the row?
This discussion has been closed.
Answers
The solution was to use
fnUpdate()
with the redraw parameter set tofalse
.Another way- which is api only vs. object method:
var temp = table.row(5).data();
temp[0] = 'Tom';
table.row(5).data(temp).invalidate();
Thank you for the solution.
Below are what it has been worked around for my case. Just in case anyone wants to update the row base on the row class or id.
var table = $('#table1').dataTable();
temp[0] = 'Tom';
table.fnUpdate(temp, $('tr#rowId'), undefined, false);
Hi,
I am in a need of updating a single row in a table rather than loading the whole table which piles up my memory. So in order to update a row I wanted to identify the row to be updated by some identifier may be a row id and perform the update of the coumns in that specific row. How can I achieve this. I tried fnupdate but seems to have depricated.
Hi @jithubabu ,
You can update row data with
row().data()
.If that doesn't help, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin