User-1826049516 posted
Hey,
I'm doing this:
var rowCount;
var opt = action === "delete" ? "restore" : "delete";
$( "table.data" ).each( function( event ) {
var table = $( this );
$( "input:checkbox:checked" ).each( function( event ) {
target = $( this );
var row = target.closest( "tr, li" );
var tag = row.prop( "tagName" );
row.fadeOut( "slow", function( event ) {
switch( tag.toLowerCase() ) {
case "tr":
var container = $( this ).find( "div." + action );
container.find( "a" ).attr( "title", opt + " this link" );
container.find( "a > img" ).attr( "src", "/images/" + opt + "-no.png" );
container.find( "a > img" ).attr( "alt", opt );
container.find( "input:first" ).attr( "name", opt );
container.find( "input:last" ).val( "/images/" + opt + "-no.png" );
container.removeClass( action ).addClass( opt );
switch( action ) {
case "delete":
$( this ).addClass( "delete" );
break;
case "restore":
$( this ).removeClass( "delete" );
row.fadeIn( "fast" );
break;
}
break;
case "li":
$( this ).remove();
break;
}
} );
} );
rowCount = table.find( "tbody > tr:visible" ).length;
table.closest( "div.content" ).prev( "div.header" ).find( "h2 > span" ).html( rowCount );
No matter where I put the last 2 lines, they're firing before the row is hidden so the rowCount never changes.