I have built a custom table of contents similar to the TOC widget http://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109. The only problem I have is how I am going to display the feature layer icon as the legend. function generateLegend(listOfLayers){
require(["esri/layers/FeatureLayer", "dojo/on"],
function (FeatureLayer, on) {
//initialazing the feature layer and adding them in a list and on the map
var layerList = [];
for(var i=0; i < listOfLayers.length; i++){
layerList = new FeatureLayer(urlList);
map.addLayer(layerList);
}
for(var i = 0; i < nameList.length; i++){
var layerId = "Layer" + i; //id for the layer
var layerPostid = "teste" + i; //id for the layer
//I also want to display the icon here
//html list to be dispalyed on the browser
layerDisplay += "<li id='" + layerPostid + "'><input type='checkbox' checked='yes' id=" + layerId + ">" + legendIcon + "<a href='#' id=" + layerId + " onclick='return false;'>" + nameList + "</a><ul><li><div class='slider'></div></li></ul></li>";
}
layerDisplay += "</ul>";
//displaying the legend
$("#tocLegend").html(layerDisplay);
});
}Any ideas how I could achieve this please?