Displaying a modal "busy" dialog while sorting a table

Discussion in 'Javascript' started by frosted74@gmail.com, Feb 14, 2008.

  1. Guest

    Hi,

    I have 2 javascript functions, one that sorts a table and one that
    shows/hides a modal dialog that displays something like "Sorting" with
    a little icon indicating that the browser is "busy" and you need to
    wait. This is done because on larger tables the sort routine can take
    upwards of 10 seconds. I try the following code:

    <th onclick="showModal(); sort(this); hideModal();">some header</th>

    but unfortunately the modal code is never displayed. If I throw in an
    alert, it will display properly, but this seems to be a timing/
    redrawing issue. This app only has to work for IE, but I'd like it to
    work across all browsers. I tried throwing in a couple setTimeOut's
    in there, but no luck so far, I even tried to simulate clicks on
    different hidden form elements which would cause the panels to be
    shown/hidden and even sorting, but all with no luck. Has anyone
    encountered anything similar to this and gotten it to work? Any help
    is appreciated!

    Thanks!
    , Feb 14, 2008
    #1
    1. Advertising

  2. GArlington Guest

    On Feb 14, 4:03 pm, wrote:
    > Hi,
    >
    > I have 2 javascript functions, one that sorts a table and one that
    > shows/hides a modal dialog that displays something like "Sorting" with
    > a little icon indicating that the browser is "busy" and you need to
    > wait. This is done because on larger tables the sort routine can take
    > upwards of 10 seconds. I try the following code:
    >
    > <th onclick="showModal(); sort(this); hideModal();">some header</th>
    >
    > but unfortunately the modal code is never displayed. If I throw in an
    > alert, it will display properly, but this seems to be a timing/
    > redrawing issue. This app only has to work for IE, but I'd like it to
    > work across all browsers. I tried throwing in a couple setTimeOut's
    > in there, but no luck so far, I even tried to simulate clicks on
    > different hidden form elements which would cause the panels to be
    > shown/hidden and even sorting, but all with no luck. Has anyone
    > encountered anything similar to this and gotten it to work? Any help
    > is appreciated!
    >
    > Thanks!


    What is in your showModal()?
    The code would be more helpful than a description...
    GArlington, Feb 14, 2008
    #2
    1. Advertising

  3. On Thu, 14 Feb 2008 08:03:25 -0800, frosted74 wrote:

    > Hi,
    >
    > I have 2 javascript functions, one that sorts a table and one that
    > shows/hides a modal dialog that displays something like "Sorting" with a
    > little icon indicating that the browser is "busy" and you need to wait.
    > This is done because on larger tables the sort routine can take upwards
    > of 10 seconds. I try the following code:
    >
    > <th onclick="showModal(); sort(this); hideModal();">some header</th>
    >
    > but unfortunately the modal code is never displayed. If I throw in an
    > alert, it will display properly, but this seems to be a timing/
    > redrawing issue. This app only has to work for IE, but I'd like it to
    > work across all browsers. I tried throwing in a couple setTimeOut's in
    > there, but no luck so far, I even tried to simulate clicks on different
    > hidden form elements which would cause the panels to be shown/hidden and
    > even sorting, but all with no luck. Has anyone encountered anything
    > similar to this and gotten it to work? Any help is appreciated!
    >
    > Thanks!


    I've run into this before, browsers not updating the screen until after
    the Javascript has finished.

    call a function that:
    updates your screen
    sets a timout to call the sort function (minimal delay)

    Then your sort function finishes and hides the busy message.

    (I don't know what sort algorithm you are using, but a couple of them can
    [semi] easily be modified to run in 'spurts' on a timeout. This would
    keep things from appearing locked up.)
    Jeremy J Starcher, Feb 14, 2008
    #3
  4. Guest

    On Feb 14, 12:13 pm, GArlington <> wrote:
    > On Feb 14, 4:03 pm, wrote:
    >
    >
    >
    > > Hi,

    >
    > > I have 2 javascript functions, one that sorts a table and one that
    > > shows/hides a modal dialog that displays something like "Sorting" with
    > > a little icon indicating that the browser is "busy" and you need to
    > > wait. This is done because on larger tables the sort routine can take
    > > upwards of 10 seconds. I try the following code:

    >
    > > <th onclick="showModal(); sort(this); hideModal();">some header</th>

    >
    > > but unfortunately the modal code is never displayed. If I throw in an
    > > alert, it will display properly, but this seems to be a timing/
    > > redrawing issue. This app only has to work for IE, but I'd like it to
    > > work across all browsers. I tried throwing in a couple setTimeOut's
    > > in there, but no luck so far, I even tried to simulate clicks on
    > > different hidden form elements which would cause the panels to be
    > > shown/hidden and even sorting, but all with no luck. Has anyone
    > > encountered anything similar to this and gotten it to work? Any help
    > > is appreciated!

    >
    > > Thanks!

    >
    > What is in your showModal()?
    > The code would be more helpful than a description...


    The showModal() called a function of RichFaces, which is a JSF-API
    from Exadel. The method itself is really inconsequential, it works on
    its own, it's just when called in combination with the other functions
    it ceases to work properly. The solution presented by Jeremy works,
    thanks! I am wondering though, is there some instances where
    setTimeout will not work properly if the client is on a slower
    machine? I am concerned because the "modal" window popping up
    prevents the user from any other interaction on the page, and the end
    of my method removes that window and resumes normal operation. I
    guess I'm just worried about that 'window' being stuck on the screen.
    Right now I am using a 20ms timeout, have you found a sweet spot for a
    timeout?

    Thanks again, your help is appreciated!
    , Feb 14, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leila
    Replies:
    0
    Views:
    389
    Leila
    Apr 26, 2005
  2. Matt
    Replies:
    1
    Views:
    3,122
    Whitecrest
    Jun 1, 2004
  3. Don
    Replies:
    0
    Views:
    339
  4. Joe Van Dyk

    dialog that pops up when window busy

    Joe Van Dyk, Jan 11, 2006, in forum: Ruby
    Replies:
    2
    Views:
    113
    Joe Van Dyk
    Jan 11, 2006
  5. Charles Lowe

    WIN32OLE disable busy dialog etc

    Charles Lowe, Apr 17, 2008, in forum: Ruby
    Replies:
    6
    Views:
    170
    Masaki Suketa
    Apr 27, 2008
Loading...

Share This Page