I'd like to add a configuration option for the "preloadOnStart" setting in my application's settings menu for the Web AppBuilder. The problem is that this settings option is contained in the appConfig (root/config.json), inside the widget's object in the widget pool. I've only been able to adjust the widget's normal config (root/widgets/MyWidget/config.json) using the examples I've found online. I'd also like to set other properties, like the widget id, inside this config file somewhere.
I just don't want my user to have to go into the file and type that in manually, I'd like for the system to take care of it somewhere for them. How does the WAB create the app config file, and how could I create a configuration option for appConfig items like this? Thanks, I appreciate any input.
Thanks for your reply, that does help.
To my understanding, though, the config object that specifies the widget I'm configuring may change locations depending on where the user puts it (say, in a controller versus not in one.) That means I'd have to search the appConfig for the correct object. I can do that, but that brings up another problem: what if my user has to widgets with the same name? If I searched for it by "name" I could potentially be configuring the wrong app's config. Is there a better way than this?
Thanks a lot,
Hey Robert, thanks for all your help.
I did think of that. The problem, though, is that I need to set the id in the appConfig in the first place. I can't find it by id if I don't know what id it's set to before I use it. Is there a way of knowing what id the builder gives the widget before I change it?
Let me know, thanks again for your help!
Ok I was not thinking about you not running this code in the same widget you wanted the id for. The widgetManager class has several methods for getting widgets (by Id, by Label, by name).