Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Displaying a modal "busy" dialog while sorting a table

Reply
Thread Tools

Displaying a modal "busy" dialog while sorting a table

 
 
frosted74@gmail.com
Guest
Posts: n/a
 
      02-14-2008
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!
 
Reply With Quote
 
 
 
 
GArlington
Guest
Posts: n/a
 
      02-14-2008
On Feb 14, 4:03 pm, (E-Mail Removed) 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...
 
Reply With Quote
 
 
 
 
Jeremy J Starcher
Guest
Posts: n/a
 
      02-14-2008
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.)
 
Reply With Quote
 
frosted74@gmail.com
Guest
Posts: n/a
 
      02-14-2008
On Feb 14, 12:13 pm, GArlington <(E-Mail Removed)> wrote:
> On Feb 14, 4:03 pm, (E-Mail Removed) 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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening modal page from modal page Don ASP .Net 0 05-27-2008 11:49 PM
Modal and non modal in same app Leila Java 0 04-26-2005 09:48 PM
How to close a parent modal window when child modal window opens? gopal srinivasan Javascript 0 11-05-2004 05:59 AM
post the form data in modal window and close the modal window. Matt HTML 1 06-01-2004 08:22 PM
post the form data in modal window and close the modal window. Matt Javascript 0 06-01-2004 07:47 PM



Advertisments