So I had a really annoying thing where I had to disable export for all data layers by default for my client, which made me have to go into each individual data source and layer to turn off exports one by one, which was taking me hours sometimes as some web maps had over 70 layers, multiple hierarchies deep, so i would often lose my place when i was trying to disable them one by one.
Well, I dug and dug and dug... and I found a solution!
If you are on Developer Edition you can follow what I've outlined here
----------------------------------------------------------------------------------------------------------------------------------------------------
What I did was went and changed the boolean value in one of the files.
In the Experience Builder installation folder navigate to the following file
client\dist\jimu-core\data-source.js
find the line
return r?r.allowToExportData():(console.error("Origin data source is not created, allow to export data by default. Output data source id is ",this.id),Promise.resolve(!0))}return!this.getDataSourceJson().disableExport
change
Promise.resolve(!0))}return!this.getDataSourceJson().disableExport
to
Promise.resolve(!0))}return this.getDataSourceJson().disableExport
Now all layers will default to not allow export when the app's config.json flag disableExport is not yet set. Note that anyone looking in the config.json will get confused because this flag will no longer make sense.
Additionally, this also creates chaos in the builder because the toggle in the data panel still says "Allow export". So I went ahead and changed this text to "Disable export" as well so the toggle button makes more sense.
That can be done by following these steps:
Navigate to
Client\dist\builder\widgets\data-source-setting\dist\runtime\widget.js
change
allowExport:"Allow export",
to
allowExport:"Disable export",
Congrats! Now you don't have to wait months or years for Esri to give you this simple feature!
Also of course, if you are upgrading Experience Builder to a future version, you'll have to do this again. And they might possibly change the code so this no longer works. But we'll see I guess.