Wait cursor

721
2
12-03-2017 06:45 PM
MohammadrezaNikfal1
Occasional Contributor

When I click om my Map View, it takes time to appear my custom popup. How can I show "Wait cursor" like default popups during this time?

0 Kudos
2 Replies
ThomasSolow
Regular Contributor

The cursor is set from CSS. So setting the view container's style.cursor attribute to "wait" will do this. ie:

var el; // the element containing your map (3.X) or view (4.X)
el.style.cursor = "wait";

In the 4.X API, you should be able to get a reference to the surface element using view.surface.  From here, you can set the "data-cursor" attribute to change the cursor:

view.surface.setAttribute("data-cursor", "wait"); // set to wait

view.surface.setAttribute("data-cursor", "default"); // back to default
AlexanderRyzhov2
New Contributor II

In  js api 4.11 (4.12) you can use undocumented "Spinner widget ".

It does the job when you use default popup widget, but it could be shown by your code too:

 

require([
   //
   "esri/widgets/Spinner",
   //...
],            
function(
  //...
  Spinner,
) {
    //...
 ‍‍‍‍‍‍‍‍   const spinner = new Spinner({
          view: view
    });
    view.ui.add(spinner);
//...
    view.on("click", runIdentify);
//...
    function runIdentify(event) {
        spinner.show({
              location : event.mapPoint
        });
    }
    //...
    spinner.hide();
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos