Joofe Kopp Joofe Kopp - 1 year ago 74
Javascript Question

jQuery Datatable - How to delete a row using cell value

I want to search a cell in my JQuery datatable which has the content of var x and delete the row which contains the cell.

I tried this:

function deletedatarow(){
var x = "tzr";
$( "tr:contains('" + x + "')").fnDeleteRow();

but it doesnt work.

Can anyone tell me why and help me to find a solution?

Answer Source

If you're referring to the jQuery DataTables plugin, then you're doing it wrong, your code should look something like this:

// Set oDatatables variable somewhere above this line..    
function deletedatarow(){
  var x = "tzr";
  $( "tr:contains('" + x + "')").each(function() {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download