hubertlo template - Layers selection question

Discussion created by hubertlo on Nov 1, 2012
I have been modifying the basic viewer template project from for my own project. The Layer list is created by this function in the layout.js file:
//Create a menu with a list of operational layers. Each menu item contains a check box
//that allows users to toggle layer visibility.
function addLayerList(layers) {
 var layerList = buildLayerVisibleList(layers);
 if (layerList.length > 0) {
  //create a menu of layers
  var menu = new dijit.Menu({
   id : 'layerMenu'
  dojo.forEach(layerList, function(layer) {
   menu.addChild(new dijit.CheckedMenuItem({
    label : layer.title,
    checked : layer.visible,
    onChange : function() {
     if (layer.layer.featureCollection) {
      //turn off all the layers in the feature collection even
      //though only the  main layer is listed in the layer list
      dojo.forEach(layer.layer.featureCollection.layers, function(layer) {
     } else {


  var button = new dijit.form.DropDownButton({
   label :,
   id : "layerBtn",
   iconClass : "esriLayerIcon",
   title :,
   dropDown : menu


There is nothing wrong about this in runtime except the user can really see whatever is last checked in the list of checkboxes. I have been digging for few hours but I cannot find anyway to uncheck the other layers in runtime. I want these checkboxes to behave like Radio Buttons. There is no radio buttons in dijit menu items and I am not in the stage to rewrite this layer selection from scratch. If I give an "id" to the CheckedMenuItem, I can get to it using dojo.byId in runtime. But then none of the .checked, .set("checked", [true/false]), etc. will work.

Is there anything I can do?