Hi There,
I have been working with the Print Widget, which is very helpful. I successfully wrote JavaScript to hide the Layout Tab. I couldn't find a standard setting for hiding it. On the Map Only tab, the widget continues to default to true for "Include attribution". For my user case, we don't want it to default to true. Is there a way to set the default to false? I have written JavaScript to set it back to false when certain actions occur, but it doesn't always hold up well as a user makes a lot of interactions such as moving between tabs, opening and closing the advanced options, etc. It can become reset to true. Any default settings that hold would be very helpful.
Thank you in advance for responses,
Dan
Solved! Go to Solution.
While this isn't optimal, I have found by setting the checkbox of the widget to false with an actual JavaScript ".click();" command solved my problem. I would much rather have an option when declaring the widget, so I'm still interested in hearing if that functionality exists.
Below is the code that worked for me. I call this in a few situations, such as when making the widget visible, clicking the "Map only" tab, and clicking the "Exports" tab. It is not the preferred method, but this works for the moment.
const elements = document.querySelectorAll('[data-option-name="attributionEnabled"]');
for (let i = 0; i < elements.length; i++) {
const itemLocal = elements[i];
if (itemLocal.checked) {
itemLocal.click();
}
}
While this isn't optimal, I have found by setting the checkbox of the widget to false with an actual JavaScript ".click();" command solved my problem. I would much rather have an option when declaring the widget, so I'm still interested in hearing if that functionality exists.
Below is the code that worked for me. I call this in a few situations, such as when making the widget visible, clicking the "Map only" tab, and clicking the "Exports" tab. It is not the preferred method, but this works for the moment.
const elements = document.querySelectorAll('[data-option-name="attributionEnabled"]');
for (let i = 0; i < elements.length; i++) {
const itemLocal = elements[i];
if (itemLocal.checked) {
itemLocal.click();
}
}
Disabling attribution is supported in the SDK, you need to set attributionEnabled to false in the templateOptions property of the print widget.
const print = new Print({
view: view,
templateOptions:{
attributionEnabled: false
}
);