Code to add cursor changes for the 2.0 TreeView when using PopulateNodesFromClient

K

KJ

Rather than ask a question, I'm going to offer something here which
you may find useful. If you're like me, you want the end-user to know
that data is being loaded from the server. The javascript function
below adds a simple cursor change to href for the callback which
initiates the server-side TreeNodePopulate event. Unfortunately, it's
not perfect. You have to have a rough estimate as to how long the
method call will take (I chose 4 seconds in the example below). If
there's a better way to do this, I'd love to hear about it.

function ExtendTreeviewClicks()
{
var Anchors = document.getElementsByTagName("a");
if (Anchors && Anchors.length > 0)
{
for (var a=0; a < Anchors.length; a++)
{
var PopHref = "javascript:TreeView_PopulateNode";
var TogHref = "javascript:TreeView_ToggleNode";
var TheId = Anchors[a].id;
var NewHref = "";

if (Anchors[a].href.substring(0, PopHref.length) == PopHref)
{
NewHref =
Anchors[a].href.replace(
/javascript:TreeView_PopulateNode/,
"javascript:document.getElementById('" + TheId +
"').style.cursor = 'wait';window.setTimeout('ExtendTreeviewClicks()',
4000);TreeView_PopulateNode"
);

Anchors[a].href = NewHref;
}

if (Anchors[a].href.substring(0, TogHref.length) == TogHref)
{
if (document.getElementById(TheId).style.cursor == 'wait')
{
document.getElementById(TheId).style.cursor = 'default';
}
}
}
}
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top