I've had a minor issue with a function I'm using to toggle a large number of rows (200+) in a large table (300+ rows, 20+ columns). Initially I tried the following code (forgive any typos, typing this at home, not work, so I may have some minor issues) am am curious why it doesn't work the way I'd expect:

// d = detail
// w = wait...
// t = #tableid tbody
function toggleZero(d,w,t) {
   d.hide();
   w.show();
   $("tr:not(.nonZero)",t).toggle();
   w.hide();
   d.show();
};


I'd expect it to do those operations in that order but oddly the d.hide and w.show do not happen until the same time that the toggle() resolves, causing them to flash and disappear in a fraction of a second (the toggle takes >10 seconds). I find this odd. Can someone explain why this happens?

I worked out a workaround today with some support from #jQuery on freenode:

function toggleZero(d,w,t) {
   d.hide();
   w.show();
   setTimeout( function() {
       $("tr:not(.nonZero)",t).toggle();
       w.hide();
       d.show();
      }, 100 );
};

I'm glad to have a workaround but am still curious, why doesn't the first function work the way I think it should?

aquaone

Reply via email to