I want to set two layers A and B in the swipe widget for comparison, once the widget is open, these two layers are automatically turned on. Layer A is set as my default swipe layer. I guess my question is that how do I turn on both layers in the layer list widget everytime when I open the swipe widget? Thanks!
Solved! Go to Solution.
Lei,
in the startup of the LayerList widget add
this.fetchData();
Hi, Robert,
Does the following codes look OK to you? I inserted it to Swipe widget js file, but the alert statement does not show up. Why it does not send out anything? Thanks!
_onPublishClick: function() {
alert("Sending out message");
this.publishData({
message: ''
});
},
Lei,
So what is calling _onPublishClick in the swipe widget? I would have just added
this.publishData({
message: ''
});
to the onOpen function.
I will keep working on it. Thanks a lot for your advise!
I followed the solution to add the code like this. It is not working. Is it correct I added the code? Thank you all!
onOpen: function () {
this.publishData({
message: 'Please turn on Aerials 2019 and Aerials 1951 layers'
});
if (true === this._isTestSizeFlag) {
return;//skip first on-open(1st open called from jimu)
}
//re-create
this._loadLayerInfos().then(lang.hitch(this, function () {
var layerInfos = utils.getVisibleLayerInfos(this.layerInfosObj);
this.setDefaultOptions(layerInfos);
this.createSwipeDijit(/*selected*/);
// this.a11y_updateFocusNodes({isFouceToFirstNode: true});
}));
},