Find and replace cell value with Datatables plugin
I'm looking to find and replace specific values from a known column using a plugin called Datatables.
Here is my code for that:
table.columns(5).search('valuetochange').cells().every( function () {
this.data('newvalue');
});
But it doesn't work, I also tried other solutions but I didn't find a way to update the cells.
thanks for the help
+3
source to share
1 answer
I haven't used the search method, but alternatively this will definitely work
table.column(5).nodes().each(function (node, index, dt) {
if(table.cell(node).data() == valuetochange){
table.cell(node).data('100');
}
});
Here is a demo http://jsfiddle.net/dhirajbodicherla/189Lp6u6/12/
+2
source to share