function addLegend(layerInfo) { var legendTb = new dijit.form.ToggleButton({ showLabel: true, label: i18n.tools.legend.label, title: i18n.tools.legend.title, checked: true, iconClass: 'esriLegendIcon', id: 'legendButton' }, dojo.create('div')); dojo.byId('webmap-toolbar-left').appendChild(legendTb.domNode); dojo.connect(legendTb, 'onClick', function () { navigateStack('legendPanel'); }); var legendCp = new dijit.layout.ContentPane({ title: i18n.tools.legend.title, selected: true, region: 'center', id: "legendPanel" }); dijit.byId('stackContainer').addChild(legendCp); dojo.addClass(dojo.byId('legendPanel'), 'panel_content'); var legendDijit = new agsjs.dijit.TOC({ map: map, layerInfos: layerInfo, collapsed: true, // slider: true }, dojo.create('div')); dojo.byId('legendPanel').appendChild(legendDijit.domNode); navigateStack('legendPanel'); if (dojo.isIE === 8) { setTimeout(function () { legendDijit.startup(); }, 100); } else { legendDijit.startup(); } }
Can anyone look into my code and see where I am committing mistakes
Regards
Ganesh
Hi Genash,Can you recreate your issue using http://jsfiddle.net/ ? Also, remove the trailing comma:
var legendDijit = new agsjs.dijit.TOC({
map: map,
layerInfos: layerInfo,
collapsed: true,
// slider: true
}, dojo.create('div'));
var legendDijit = new agsjs.dijit.TOC({
map: map,
layerInfos: layerInfo,
collapsed: true
}, dojo.create('div'));
With that said, have you used any tools like jshint or jslint to clean up your code? They are incredibly powerful!*editLooking at Nliu's documentation:
toc = new TOC({
map: map,
layerInfos: [{
layer: featLayer1,
title: "FeatureLayer1"
}, {
layer: dynaLayer1,
title: "DynamicMapServiceLayer1"
//collapsed: false,
// whether this root layer should be collapsed initially, default false.
//slider: false // whether to display a transparency slider.
}]
}, 'tocDiv');
I've never used Nliu's TOC widget but hope this helps. I found this from reading his documentation.