Getting layers in CheckBox Selection

442
2
Jump to solution
11-06-2012 09:10 AM
SmaranHarihar
New Contributor III
I have 4 MXDs and each has more than 10 layers. Now when I add them using the ArcGISDynamicMapLayers, I am only able to add the Map Service but I wish to display the layers with the check box. How can I do that.

It should look something like this. The Federal Funding and Economy are the Map Service and the Growth, Income and other are the layers within Economy Map Service. This image is how it was implemented in Flex, how can I implement it in JavaScript?
0 Kudos
1 Solution

Accepted Solutions
SmaranHarihar
New Contributor III
I created something similar using this sample - http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/map_dynamiclay...

I also found a variation of this sample that was helpful - http://maps.roktech.net/demo/toc_example/index.htm

hope that helps


Thanks for the reply. I tried a different technique,

for (var i=0; i<ddMapServ.length; i++) {    var url = ddMapServ;    var requestHandle = esri.request({     "url": url,     "content": {      "f": "json"     },     "callbackParamName": "callback"     })    requestHandle.then(requestSucceeded, requestFailed);   }


Where the ddMapServ is the array of MapService whose layer I want to fetch.

function requestSucceeded(response, io) {    if (response.hasOwnProperty("layers") ) {     var lyr=[];     dojo.map(response.layers, function(f) {      lyr.push(f.name);     });     ddLyrName.push(lyr);    }   }

View solution in original post

0 Kudos
2 Replies
VernWolfley
New Contributor III
I created something similar using this sample - http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/map_dynamiclay...

I also found a variation of this sample that was helpful - http://maps.roktech.net/demo/toc_example/index.htm

hope that helps
0 Kudos
SmaranHarihar
New Contributor III
I created something similar using this sample - http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/map_dynamiclay...

I also found a variation of this sample that was helpful - http://maps.roktech.net/demo/toc_example/index.htm

hope that helps


Thanks for the reply. I tried a different technique,

for (var i=0; i<ddMapServ.length; i++) {    var url = ddMapServ;    var requestHandle = esri.request({     "url": url,     "content": {      "f": "json"     },     "callbackParamName": "callback"     })    requestHandle.then(requestSucceeded, requestFailed);   }


Where the ddMapServ is the array of MapService whose layer I want to fetch.

function requestSucceeded(response, io) {    if (response.hasOwnProperty("layers") ) {     var lyr=[];     dojo.map(response.layers, function(f) {      lyr.push(f.name);     });     ddLyrName.push(lyr);    }   }
0 Kudos