AnsweredAssumed Answered

Showing a wait cursor in different divs

Question asked by kenbuja Champion on Apr 8, 2013
Latest reply on Apr 10, 2013 by kenbuja
I'm using nliu's TOC script and am playing the example script (I'm just making the transition to JavaScript from Flex).

Some of my layers can be complex and take a little while to actually appear on the map, so I'd like to show a wait cursor until the layer is ready. I'm using the onUpdateStart and onUpdateEnd to change the cursor, but this is only appearing when the cursor is in the TOC div. If I move the cursor to the map div, the cursor changes to the default cursor. How do I make the wait cursor show in both divs?

Here's the coding I'm using

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ""> <html> <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">     <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />     <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />     <title>TOC</title>     <!--<link rel="stylesheet" type="text/css" href="">-->     <link rel="stylesheet" href="">     <link rel="stylesheet" href="">     <link rel="Stylesheet" type="text/css" href="css/style.css" />      <style>         html, body         {             height: 98%;             width: 98%;             margin: 0;             padding: 5px;             font-family: helvetica, arial, sans-serif;             font-size: 90%;         }           #leftPane         {             width: 280px;             overflow: auto;         }         /* this line hide layers when out of scale for the inline TOC */         #scaleDiv .agsTOCOutOfScale         {             display: none;         }     </style>     <script type="text/javascript">         var djConfig = {             parseOnLoad: true,             packages: [{                 "name": "agsjs",                 "location": location.pathname.replace(/\/[^/]+$/, "") + '/agsjs'                 // "location": location.pathname.replace(/\/[^/]+$/, "")+'/../build/agsjs'                 //"location": '' // for xdomain load             }]         };     </script>     <!--<script type="text/javascript" src="">-->     <script src=""></script>      </script>         <script type="text/javascript">             //             //dojo.require("dijit.dijit");             dojo.require("dijit.layout.BorderContainer");             dojo.require("dijit.layout.ContentPane");             // uncomment if want dojo widget style checkbox             //dojo.require('dijit.form.CheckBox');             dojo.require("");             dojo.require("dijit.layout.AccordionContainer");             dojo.require("dojo.fx"); // needed if use jsapi 3.0             dojo.require("agsjs.dijit.TOC");         </script>     <script type="text/javascript">         var map;         function init() {             map = new esri.Map("map", {                 showAttribution: false              });               //Add the terrain service to the map. View the ArcGIS Online site for services http://arcgisonline/home/search.html?t=content&f=typekeywords:service                 var basemap = new esri.layers.ArcGISTiledMapServiceLayer("");             map.addLayer(basemap);              var layerSEFCRI = new esri.layers.ArcGISDynamicMapServiceLayer("", {                 id: 'SEFCRI'              });              dojo.connect(map, 'onLayersAddResult', function (results) {                  var toc = new agsjs.dijit.TOC({                     map: map,                     layerInfos: [{                         layer: layerSEFCRI,                         title: "SEFCRI",                         slider: true                     }]                 }, 'tocDiv');                  toc.startup();                  layerSEFCRI.setVisibleLayers([0]);              });             map.addLayers([layerSEFCRI]);    = "wait";              dojo.connect(layerSEFCRI, "onLoad", function () {                 map.setExtent(layerSEFCRI.initialExtent, true);        = "default";             });              dojo.connect(layerSEFCRI, "onUpdateStart", function () {        = "wait";             });              dojo.connect(layerSEFCRI, "onUpdateEnd", function (error) {        = "default";                 if (error) {                     alert("Updated completed with error: " & error);                 }             });              //resize the map when the browser resizes - view the 'Resizing and repositioning the map' section in             //the following help topic for more details                   var resizeTimer;             dojo.connect(map, 'onLoad', function (theMap) {                 dojo.connect(dijit.byId('map'), 'resize', function () { //resize the map if the div is resized                     clearTimeout(resizeTimer);                     resizeTimer = setTimeout(function () {                         map.resize();                         map.reposition();                     }, 500);                 });             });          }          dojo.addOnLoad(init);     </script> </head> <body class="claro">      <div id="content" dojotype="dijit.layout.BorderContainer" design="headline" gutters="true" style="width: 100%; height: 100%; margin: 0;">      <!--            <div id="header" dojotype="dijit.layout.ContentPane" region="top">                  <div>                     <b>Table Of Content (TOC/Legend) Widget</b>  <a style="right:20px;position: absolute" href="../docs/toc/examples.html">Documentation</a>                 </div>                                     <ul style="margin:2px">                     <li>                         Click check box to turn on/off layers. When click on groups, all sublayers will be turned on/off.                     </li>                  </ul>             </div>-->         <div dojotype="dijit.layout.ContentPane" id="leftPane" region="left" splitter="true">             <div id="tocDiv">             </div>          </div>         <div id="map" dojotype="dijit.layout.ContentPane" region="center">         </div>     </div> </body> </html>