How can we turn on layers from a different widget (other than the layer list) say - for example my widget only works when this certain layer is on (by default they are all off)
Thank you
Solved! Go to Solution.
Zhujing,
I am not sure if I can explain it any better then the info in this thread. What specific part are you not understanding?
Robert,
I put your code in the Screen Widget under Report Button, but it dose not work.
this._initLayerInfosObj().then(lang.hitch(this, function() {
if(!this.layerInfosObj.getLayerInfoById('IP_IndianPoint_3610').isVisible()){
this.layerInfosObj.getLayerInfoById('IP_IndianPoint_3610'').setTopLayerVisible(true);
}
if (!this.hasVisibleTemporalLayer()) {
html.setStyle(this.noTimeContentNode, 'display', 'block');
html.setStyle(this.timeContentNode, 'display', 'none');
this._showed = true;
}
}
}));
Zhujing,
Your problem is you are just copy and pasting code and expecting it to work. That code you were copying was specifically for the TimeSlider widget.
You need to use my original code I posted, that has the require.
Robert,
I used your original code and it works.
LayerInfos.getInstance(this.map, this.map.itemInfo).then(function(layerInfosObject){
layerInfosObject.getLayerInfoById('IP_IndianPoint_3610_8').setTopLayerVisible(true);
});
Thanks
Zhujing