It's funny, my guess is the opposite of Scott's. I'm also not familiar with
the flot code, but it sounds like something that may run *synchronously* and
therefore locks up the browser until it is completed. Any changes you make
to the DOM will not show up on the display until this finishes.

If that's the case, you can fix it with a setTimeout:

$(tab_selector).click(function() {
  $(clicked_tab).text("Loading");
  setTimeout( function() {
    [Flot calls to change the datasets and redraw the graph]
    $(clicked_tab).text("Previous Text");
  }, 1 );
});

The setTimeout will let the browser catch its breath and update the loading
text before you start the lengthy flot operation.

-Mike

> From: Leanan
> 
> I apologize if this gets posted twice, but it looks like my 
> last attempt to post got swallowed by the ether.
> 
> I'll make it short:
> 
> I have flot and ui tabs.  Because I'm processing a rather 
> large set of data, and excanvas, switching the datasets 
> graphed takes a few seconds.  I want to add feedback, so that 
> when a tab is clicked, it's title changes to "Loading..." and 
> then when the graph is drawn, it switches back to it's 
> original text.  I have this working, but the changes only 
> show when I step through with a debugger.  When I run 
> normally, it appears as if the changes to the text to 
> "Loading..." and back to the default aren't being displayed 
> until the click handler is finished, which makes it appear as 
> if nothing is actually happening.
> 
> I've searched through the jquery books I have (learning 
> jquery and the jquery reference) as well as online 
> documentation and I can't find anything that confirms or 
> denies this behavior as being proper.
> 
> Does anyone know how I can get the following to work and 
> actually display the results of the .text() calls inside the 
> click() instead of after the .click() has processed?  Thanks 
> in advance
> 
> (pseudo)
> 
> $(tab_selector).click(function() {
>   $(clicked_tab).text("Loading");
>   [Flot calls to change the datasets and redraw the graph]
>   $(clicked_tab).text("Previous Text");
> });
> 

Reply via email to