Editing a Datatable Column get restored to it's original value when I do a Global Search....
Editing a Datatable Column get restored to it's original value when I do a Global Search....
@DasDeva
Posts: 6Questions: 2Answers: 0
In a datatable, if i search something and edit a row cell (change a textbox value or check/uncheck checkbox) , and if I clear out the search, the edited column value is getting reverted back to the original value. Also, I a edit a row cell and do a Search, again the edited column value is getting replaced to the original value.
I guess search reads the data from Cache. I am not sure how to change the data in the chache....
Any help is much appreciated...
This discussion has been closed.
Answers
You can use
rows().invalidate()
to invalidate the cache. However, if you are searching inside a live DOM element such as aninput
element, it is more difficult than simply invalidating since DataTables will only read the HTML, not the value of the input.Allan
Hi allan, Thanks for your Reply!!
I do tried with the rows().invalidate(). I used the below codes once the column data is changed.
var table = $('#tblReassginChannels').dataTable();
$('#tblReassginChannels tbody #'+id+' td:eq(8)').html('<input type="checkbox" name="vehicle" value="Car" checked>');
table.row($('#tblReassginChannels tbody #'+id)).invalidate();
But still I am facing the issue.
This is my code to load the datatable during page load.
function LoadDataTableChannel()
{
$('#tblReassginChannels').dataTable( {
}
When any column cell is changed, i have the below code to for invalidate
var table = $('#tblReassginChannels').dataTable();
$('#tblReassginChannels tbody #'+id+' td:eq(8)').html('<input type="checkbox" name="vehicle" value="Car" checked>');
table.row($('#tblReassginChannels tbody #'+id)).invalidate();
Still i am facing this issue..... Any help is much appreciated ....
Okay, so it is live DOM searching. I'm not sure that there is a good way of doing this in DataTables to be honest.
You could possibly try using the live DOM sorting plug-ins which do interface with the search, and will refresh when the row is invalidated, but its far from optimised, or even throughly tested.
This is one of the areas where I know DataTables needs work.
Allan
Thanks allan... I will take a look in live DOM sorting plug ins