If I may I ask a related question...Has anyone set Nianwei's AGS TOC widget to not collapse layer Groups when it is turned off? In other words, I have a dynamic service with around 100 layers. I've grouped these into a few groups which works great with the AGS widget, which groups them hierarchically just like ArcMap. Now I am wondering how to make it NOT automatically collapse the groups when I turn them off. We want them to stay expanded, unless the user clicks the little "+" button. We do however want it to collapse/expand with the "+" automatically, as it does now by default.I have tinkered with the 2.05 TOC.js code and I believe the relevant block of code is below but I have not succeeded. I set a lot of those visible items to true, set both expandos to "open" etc to no avail yet. Anyone else done this or know how?
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');
}