How to clean the values in one column?
How to clean the values in one column?
Hi,
I'm working on a table with a lot of rows. In this table, I have IPs Addresses, and I have to do ping (I'm using c#) to each one and put the results in the last column. I need a button to clear the results, but I dont want to call the server to re-create the table without the results.
I tried this to clear the values:
[code]$('#example td:nth-child(8)').html('');[/code]
But, it doesn't work, because, when I scroll in the table, this code only works with the first rows.
How can I clean the values in only one column?
I'm working on a table with a lot of rows. In this table, I have IPs Addresses, and I have to do ping (I'm using c#) to each one and put the results in the last column. I need a button to clear the results, but I dont want to call the server to re-create the table without the results.
I tried this to clear the values:
[code]$('#example td:nth-child(8)').html('');[/code]
But, it doesn't work, because, when I scroll in the table, this code only works with the first rows.
How can I clean the values in only one column?
This discussion has been closed.
Replies
[code]
var table = $('#example').DataTable();
table
.rows()
.flatten()
.each( function (rowIdx) {
table.cell( rowIdx, 2 ).data( '' );
} )
.draw();
[/code]
i.e. get all the rows and iterate over each, setting the data for column index 2 to be `''` .
If you are using 1.9.4 you could probably do something similar using fnUpdate and fnGetData / fnGetNodes .
Allan