Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Max on Feb 22, 2008 02:35
open dhtmlx forum
Progress or Hourglass Cursor during loadXML() or XMLAutoLoading()

Hi,

Is there a recommended way to have the mouse cursor change to a "progress" type whilst the xml is being loading ?

Sometimes it can take a few seconds for the treenodes to open, so I think the enduser would appreciate the visual feedback...

Many thanks!
Answer posted on Feb 22, 2008 05:51
There are two events which can be used to show any kind of "loading" message.

    http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&q=948&ssr=yes&s=onXLS
Answer posted by Max on Feb 22, 2008 07:25
I tried it that way, but the cursor does not change...

I am not sure if I am approaching this the right way, so I attach my code.... does this seem reasonable ?


The tree is in a div with the id="treePlaces"

// loading events
treePlaces.attachEvent("onXLS",treePlaces_OnLoadingBegin);
treePlaces.attachEvent("onXLE",treePlaces_OnLoadingEnd);

function treePlaces_OnLoadingBegin() {
    // Set cursor to hourglass
    document.getElementById("treePlaces").className = "busy";
}

function treePlaces_OnLoadingEnd() {
    // Reset cursor
    document.getElementById("treePlaces").className = "";
}

// CSS
#treePlaces .busy
{ cursor: progress; }
Answer posted by Support on Feb 22, 2008 08:54
Just change your css rule to
#treePlaces.busy
{ cursor: progress; }

The space between elements mean parent-child relation, while in your case it is the same node.
Answer posted by Max on Feb 23, 2008 02:24
Genius!

Thank you very much!
Answer posted by David Charron on Oct 20, 2008 12:25
For those like me that had problem with the css solution.

Here is one using javascript

function mygrid_OnLoadingBegin() {
    // Set cursor to hourglass
    document.getElementById("grid_container").style.cursor = "wait";
    document.body.style.cursor = "wait";

}

function mygrid_OnLoadingEnd() {
    // Reset cursor
    document.getElementById("grid_container").style.cursor = "default";
    document.body.style.cursor = "default";
}