{ layer: altmaps, slider: true, title: "OS Basemaps", isopen: false }
if (this.data._subLayerInfos) { //acm added to collapse groups at the start this.toggler.hide() //end acm addition
//ACM also changed this line to get groups initial expand set //dojo.addClass(this.iconNode, a ? "dijitTreeExpandoOpened" : "dijitTreeExpandoClosed") dojo.addClass(this.iconNode, a ? "dijitTreeExpandoClosed" : "dijitTreeExpandoClosed")
var toc = new agsjs.dijit.TOC({ map: map, layerInfos: [{ layer: safety, title: "Safety Operations", collapsed: true },{ layer: census, title: "Census", collapsed: true }] }, 'tocDiv'); toc.startup();
Is there any way to have the map service layer initially expanded but all collapsible groups within the map service (unique value renderers and group layers) collapsed?
ok - cracked the code to get all groups collapsed - as in screenshot[ATTACH=CONFIG]18426[/ATTACH]In the postcreate function find and alter as below if (this.data._subLayerInfos) { //acm added to collapse groups at the start this.toggler.hide() //end acm addition and a bit later //ACM also changed this line to get groups initial expand set //dojo.addClass(this.iconNode, a ? "dijitTreeExpandoOpened" : "dijitTreeExpandoClosed") cSo far it appears to work. The second part could be neater, but doing it this way you can see it has been changed to always return "dijitTreeExpandoClosed"ACM
//ACM also changed this line to get groups initial expand set //dojo.addClass(this.iconNode, a ? "dijitTreeExpandoOpened" : "dijitTreeExpandoClosed") c
ok - cracked the code to get all groups collapsed - as in screenshot[ATTACH=CONFIG]18426[/ATTACH]In the postcreate function find and alter as below if (this.data._subLayerInfos) { //acm added to collapse groups at the start this.toggler.hide() //end acm addition and a bit later //ACM also changed this line to get groups initial expand set //dojo.addClass(this.iconNode, a ? "dijitTreeExpandoOpened" : "dijitTreeExpandoClosed") dojo.addClass(this.iconNode, a ? "dijitTreeExpandoClosed" : "dijitTreeExpandoClosed") So far it appears to work. The second part could be neater, but doing it this way you can see it has been changed to always return "dijitTreeExpandoClosed"ACM
var show = this.data.visible; // if it is a group layer and no child layer is visible, then collapse if (this.data._subLayerInfos) { var noneVisible = true; dojo.every(this.data._subLayerInfos, function(info) { if (info.visible) { noneVisible = false; return false; } return true; }); if (noneVisible) show = false; } if (this.data.collapsed) show = false; if (this.iconNode && this.iconNode.src == this.blank) { dojo.addClass(this.iconNode, 'dijitTreeExpando'); dojo.addClass(this.iconNode, show ? 'dijitTreeExpandoOpened' : 'dijitTreeExpandoClosed'); } if (this.containerNode) dojo.style(this.containerNode, 'display', show ? 'block' : 'none'); if (this.rootLayerTOC.toc.style == 'standard' && this.iconNode && this.checkNode) { dojo.place(this.iconNode, this.checkNode.domNode || this.checkNode, 'before'); }
TOC widget to not collapse layer Groups when it is turned off?
This method did not work for me!
Hi,
Use these tags in layerInfo:
collapsed: true,
autoToggle: false
Thanks.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.