Is it possible to update a row only by specifying changed column values?
Is it possible to update a row only by specifying changed column values?
I have a use case where I have a table that is updated (inserts and updates) in real-time. The first column in the table is a checkbox that is used to control the display of some data elsewhere in the application. I would like for the state of that checkbox to remain at whatever a user sets it to (checked, unchecked) regardless of any updates to the table. I update my table using code similar to this:
trackDataTable.row("#" + track.id).data({
"DT_RowId":track.id,
"DT_RowClass": DT_RowClass,
"SELECT": checkBox,
"CALLSIGN":track.radio,
"OPERATOR":track.operator,
"RANGE": track.range}).draw(false);
The problem with this is that the state of the checkbox is re-initialised every time the row is updated. I was hoping I could simply omit the checkbox column (select) from the update, to have something like this instead:
trackDataTable.row("#" + track.id).data({
"DT_RowId":track.id,
"DT_RowClass": DT_RowClass,
"CALLSIGN":track.radio,
"OPERATOR":track.operator,
"RANGE": track.range}).draw(false);
However, when I do this, I receive the following error:
DataTables warning: table id=trackTable - Requested unknown parameter 'SELECT' for row 2, column 0. For more information about this error, please see http://datatables.net/tn/4
I can figure a way to maintain the state of the checkbox in a map and pass it into the update so that the state is maintained each time the row is updated, but I wondered if there was an easier way to achieve what I need using Datatables? I had assumed that as I'm passing in my data as named values that it could simply match the fields that needed updating and ignore anything else?
Many thanks!