Managing config files

597
2
Jump to solution
10-29-2019 10:05 AM
Phares_Andrew
New Contributor II

For my app, I integrated a method for one widget to control the opening/closing of any amount of other widgets (in this case infographics). Everything is working but I want to make sure that I'm going about it the right way: each widget that can be opened/closed has the property "visible":false set in my app's config.json (so that each widget starts as closed).

Whenever I save changes made in the web appbuilder interface, this causes Web AppBuilder to delete every app that has visibility set to false (so that I have to add the files and fix the config.json file each time I need to make changes from the interface).

And also due to having 30+ config files, I tried sorting out my config/{widgetname}/ directory into separate folders, but on save from Web AppBuilder, it deletes the folders and adds the prefix "config_" to all contents in the directory (even though each config is already prefixed by "config_", so that the name becomes "config_config_...  ") As this seems counter intuitive, an I approaching this incorrectly? Is there some way to disable Web AppBuilder's automated config management?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Phares_Andrew
New Contributor II

Thank you for your reply – I'm following the explanation here to use the widget and panel managers open / close, and widgets configs I have defined with "visibility":false in the main config are deleted when I save Web AppBuilder.

One fix I found was to move the widgets out of the widgetpool and into widgetonscreen. When I do this Web AppBuilder recognizes the widgets, but I'm not sure why this works. Is there a reason not to declare widgets in the widgetpool with the propertery visible set to false?

View solution in original post

0 Kudos
2 Replies
shaylavi
Esri Contributor

I would highly recommend looking into examples inside other widgets on how to control and manipulate widget's behaviors properly, rather than hacking them in the cost of fixing side-effects like the one you describe.

Controlling visibility and behaviors can be done easily through the WidgetManager and PanelManager objects rather than touching configuration files. They have functions to close, open and configure widgets in the application.

Shay
0 Kudos
Phares_Andrew
New Contributor II

Thank you for your reply – I'm following the explanation here to use the widget and panel managers open / close, and widgets configs I have defined with "visibility":false in the main config are deleted when I save Web AppBuilder.

One fix I found was to move the widgets out of the widgetpool and into widgetonscreen. When I do this Web AppBuilder recognizes the widgets, but I'm not sure why this works. Is there a reason not to declare widgets in the widgetpool with the propertery visible set to false?

0 Kudos