Excluding children from a layerlist

Discussion created by islandloafer on Apr 17, 2011
Latest reply on Apr 19, 2011 by hzhu

I've used the ESRI sample for dynamically building checkbox toggles for layer visibility. However, as the layers in my map service occur several times albeit in different scales, the list layers function shows both the name of the parent group layer as well as the names of the children. Like so:

-Checkbox- Roads
-Checkbox- Roads 500
-Checkbox- Roads 1000
-Checkbox- Roads 1500

Thusly, I need a way to exclude the children from the list (Roads 500, 1000, 1500) while still having the Roads group checkbox hiding or showing all of its children. Is there some variable that I can check in the buildlayerlist function that filters out the layers I want to exclude? How would the code look?

Any help is very appreciated!

Thank you