Solved! Go to Solution.
dojo.require("dojo.fx") dojo.require("dojo.fx")
function defaultvis(layer) {
visible = [];
var items = dojo.map(layer.layerInfos, function (info, index) {
if (contains(defaultlayers, info.name)) {
visible.push(info.id);
console.debug(info.name + "ative")
} else {
console.debug(info.name)
}
});
dynamicMapServiceLayer.setVisibleLayers(visible);
}
_createRootLayerTOC: function () {
var b = this.rootLayer;
if (!b._tocInfos) {
var c = {};
dojo.forEach(b.layerInfos, function (d) {
c["" + d.id] = d;
console.debug(d)
if (contains(defaultlayers,d.name)) {
d.visible = true;
}
else {
d.visible = false;
}
.....Hi
This works fine, but of course the TOC code doesn't pick up on the changed visibility and shows all layers unticked (the default state) Any ideas how I should call a refresh or something of the TOC to get the boxes ticked?
I have noticed that I have to reload my page in order to get the TOC to display. I can see that the agsjs.dijit.TOC is created on the initial load of the page, but the results do not show up in my 'tocDiv'. I have also experienced this behavior on the internet example site http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.02/examples/toc.html on the initial load the TOC does not show, but if I refresh in IE8, it does. Just wondering if there is a work around to address this behavior. Thanks, Mele
I have exactly the same problem: when you run my app in IE9 the fist time it works however after it rerun again TOC it is not displayed any more - same happen with http://gmaps-utility-gis.googlecode.com/svn-history/r354/trunk/agsjs/examples/toc.html. I have tried to destroy dom and widjet itself - but it did not help. Is there any solution for it?