I created something similar using this sample - http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/map_dynamiclayerlist.htmlI also found a variation of this sample that was helpful - http://maps.roktech.net/demo/toc_example/index.htmhope that helps
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); }
function requestSucceeded(response, io) { if (response.hasOwnProperty("layers") ) { var lyr=[]; dojo.map(response.layers, function(f) { lyr.push(f.name); }); ddLyrName.push(lyr); } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.