3.2.0

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.
March 11,
Sorry, this was from me.
Dyme
March 11,
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
March 18,
I think I am out of ideas. :-(
Dyme
March 25,
Just a reference , with "timeout" (I never try)
/javascript.forum.3006.5/a-fun-one-for-a.html
Carlos
March 26,
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
March 26,
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
March 26,
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
March 26,
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
March 26,

This topic is archived.

See also:


Back to support forum