Tablesorter bug cloning table row with jquery -


i'm trying wrap head around why rows being duplicated once removed when tablesorter function being used. here page in question:

http://www.ffxiv-gathering.com/40.php

to duplicate bug following:

  1. click row on unspoiled tab
  2. go watching tab
  3. click row remove it
  4. go unspoiled tab , click row...then click another
  5. go watching tab

you can see first row clicked duplicated. cannot life of me figure out why. removing tablesorter function fixes problem...however, remain sorts table status (and moves current , upcoming nodes top).

here jquery running this:

$(document).ready(function() { var items = [];  $("#mytable-unspoiled >tbody >tr").on("click", function() {     var newtr = $(this).closest("tr").clone().addclass("remove");      items.push(newtr);     newtr.appendto($("#mytable-watching"));      $(".remove").click(function(){     $(this).closest('tr').remove();      var rowcount = $('#mytable-watching >tbody >tr').length;     $('#counter').html(rowcount);     });      var rowcount = $('#mytable-watching >tbody >tr').length;     $('#counter').html(rowcount);      $("#mytable-watching").tablesorter({      // sort status column, item; ascending     sortlist: [[6,0],[0,0]]     }); }); }); 

removing fixes problem prevents me sorting:

$("#mytable-watching").tablesorter({      // sort status column, item; ascending     sortlist: [[6,0],[0,0]] }); 

here page without tablesorter plugin.

http://www.ffxiv-gathering.com/40-test.php

to see issue...click colored row, white row, colored row , view watching tab.

when add and/or remove rows table, make sure trigger "update" instead of reinitializing tablesorter...

newtr.appendto($("#mytable-watching")); $("#mytable-watching").trigger("update"); 

and

$(".remove").click(function(){     var $table = $(this).closest('table');     $(this).closest('tr').remove();     $table.trigger('update');     // ... }); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -