:: Forum >>

Wait cursor before search, then return after complete

I am trying to get the wait cursor to come up when someone starts a search and then return to auto when the search has finished.

I have tried doing at the beginning of the function:
document.body.style.cursor='wait';

and at the end of the function:
document.body.style.cursor='auto';

However, I do not see the wait cursor (unless I remove the auto and it never returns to normal). Anyone have any ideas? It seems like the change needs to written out or else I am doing something wrong. I know this is maybe a bit off the grid subject.
Friday, March 11, 2005
Sorry, this was from me.
Dyme
Friday, March 11, 2005
I tried the following:

if (document.all) for (var i=0;i < document.all.length; i++) document.all(i).style.cursor = 'wait';

at the beginning and

if (document.all) for (var i=0;i < document.all.length; i++) document.all(i).style.cursor = 'auto';

at the end and this was unacceptably slow. I am not sure if it actually did what I wanted or not.

I have noticed that sorting flashes between several pointers including wait and progress. But not sure how it even does that.
Dyme
Friday, March 18, 2005
I think I am out of ideas. :-(
Dyme
Friday, March 25, 2005
Just a reference , with "timeout" (I never try)
/javascript.forum.3006.5/a-fun-one-for-a.html
Carlos
Saturday, March 26, 2005
That generate some interesting thoughts . . . maybe instead of calling the search function directly, I should do something like:

document.body.style.cursor='wait';
setTimeout('do_search', 100);

Then, after the search is done and before it returns:
document.body.style.cursor='wait';

I have not tried this yet, but may consider it. I would really like to see a wait cursor while sorting is occuring as well.
Dyme
Saturday, March 26, 2005
Maybe need to override the default sorting with a custom one, like i did in - /javascript.forum.2603.6/set-the-first-row-to.html - (this way you have a place to change the cursor or show a second empty grid with ...loading....[hiding main]) But even in this case (not sure how to know when the sort is already finished)
Carlos
Saturday, March 26, 2005
I got it, use this function to show loading.... while sorting

/////////////////////////////////////////////////
function headerClickedfunc(e) {

var boton = e.srcElement.id;
var botoninit = boton.indexOf(":" ,9);
var botonend = boton.indexOf("/" ,9);
var numboton = boton.substring((botoninit+1),(botonend));

var lastcolord = obj.getSortProperty("index");
var lastcoldir = obj.getSortProperty("direction");

obj.setStatusProperty("code", "loading");
obj.refresh();

//start timeout
window.setTimeout(function(){
if (lastcolord == numboton) {
if(lastcoldir == "ascending") { obj.sort(numboton, "descending");}
else{obj.sort(numboton, "ascending");}
}
else{obj.sort(numboton, "ascending"); }

obj.setStatusProperty("code", "");
obj.refresh();}, 0); //<< end timeout
}
//********************************
obj.getTemplate("top/item").setEvent("onmousedown", headerClickedfunc);
//////////////////////////////////////////////////////////
Carlos
Saturday, March 26, 2005
But it need an additional refresh before sorting (I remember a post asking for initially loading the grid sorted by default, and Alex answer that need a double refresh)
Anyway hope given more Ideas
Best
Carlos
Saturday, March 26, 2005

This topic is archived.


Back to support forum

Forum search