Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery moving rows between table disables javascript
    primarykey
    data
    text
    <p>Im moving rows between tables, it seems to works fine but once the row is in the other table all javascript functions related to that row no longer work and I have no idea why.</p> <p>The javascript is pretty straight forward I take the html for the row and move it into the other table.</p> <p><strong>If you click the child tabs they work fine, but click on waitlist (or approve to move to the table above) to move it to the below table and the tabs for that row no longer work.</strong></p> <p>The weird thing is no error is thrown, and nothing is logged in the console.</p> <p><a href="http://jsfiddle.net/Ha3Jq/16/" rel="nofollow">http://jsfiddle.net/Ha3Jq/16/</a></p> <h2>Jquery</h2> <pre><code>$( ".enrolled-participants" ).on("click","button.remove-participant",function(){ if($(this).hasClass('remove-participant')) { $(this).html('Approve'); $(this).removeClass('remove-participant').addClass('add-participant'); var className = $(this).closest('tr').attr('class'); var childClass =$(this).closest('tr').next().attr('class'); var current_row = $(this).closest('tr').html(); var child_row = $(this).closest('tr').next().html(); $(this).closest('tr').next().remove(); $(this).closest('tr').remove(); $('.waitlisted &gt; tbody:last').append('&lt;tr class="'+className+'"&gt;'+current_row+'&lt;/tr&gt;&lt;tr class="'+childClass+'"&gt;'+child_row+'&lt;/tr&gt;'); } </code></pre> <p>Im also using the table sorter plugin.</p> <h2>tablesorter</h2> <pre><code> $(".enrolled-participants,.waitlisted") .tablesorter({ theme : 'blue', // this is the default setting cssChildRow: "tablesorter-childRow", // initialize zebra and filter widgets widgets: ["zebra", "filter"], widgetOptions: { // include child row content while filtering, if true filter_childRows : true, // class name applied to filter row and each input filter_cssFilter : 'tablesorter-filter', // search from beginning filter_startsWith : false, // Set this option to false to make the searches case sensitive filter_ignoreCase : true } }); // hide child rows //$('.tablesorter-childRow td').hide(); // Toggle child row content (td), not hiding the row since we are using rowspan // Using delegate because the pager plugin rebuilds the table after each page change // "delegate" works in jQuery 1.4.2+; use "live" back to v1.3; for older jQuery - SOL $('.tablesorter').delegate('.toggle', 'click' ,function(){ //alert('ok'); // use "nextUntil" to toggle multiple child rows // toggle table cells instead of the row $(this).closest('tr').nextUntil('tr:not(.tablesorter-childRow)').find('td').toggle(); return false; }); // Toggle widgetFilterChildRows option $('button.toggle-option').click(function(){ var c = $('.tablesorter')[0].config.widgetOptions, o = !c.filter_childRows; c.filter_childRows = o; $('.state').html(o.toString()); // update filter; include false parameter to force a new search $('input.tablesorter-filter').trigger('search', false); return false; }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload