Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

repaint issue

Status
Not open for further replies.

ChadBryant

Programmer
Oct 29, 2004
11
US
Brief background:
Hi, I'm using a 3rd party tree control in an asp.net application. The tree control has checkboxes that you can turn on for each node in the tree. We have written some javascript that will do some things when a node is checked in the tree. Usually, this happens very fast, but if they check a node that has children with each child in the tree having children we want it to automatically check the children and grandchildren. This works fine, but it takes some time when the tree is large.

So we put a label (span tag) on the page to display a message that says "Processing selection. Please wait . . .". So when they click a node in the tree we change the label which has no text to set its innerHTML to display the text above to inform the user it is working to please wait. After it goes through the tree it does an AJAX callback. At this point, the client side processing is done and the user can continue working with the tree while the server side callback is being performed via AJAX.

The problem is the span tag innerHTML is being set right away when the node is checked, but it doesn't become visible (does not repaint the browser display) until after the client side processing is done (which in certain scenarios is the most time consuming part). So the user wait a few seconds and wonders what is happening, then they see the Processing message popup very briefly, then it goes away and all the nodes are checked and the server side processing is done.

We need a way to make the message to the user come up immediately. Is this possible? Is there a timer for javascript that we might use to do this so that the node checked event in the browser simply displays the text to the user and then "enables" the timer so that the timer controls the other clientside and AJAX callback processing? I don't know if this will work and this is a technique I've used in windows programming to handle a similar issue with a windows timer.

Anyway, thanks for your input and help!!

Chad
 
Use "setTimeout" to start your client-side processing a short while after you set your message to be visible.

For example, this will call a function "doIt" after 1 second (1000 milliseconds):

Code:
setTimeout('doIt();', 1000);

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top