Confused about widget config files

1063
4
Jump to solution
08-10-2018 09:37 AM
ZorbaConlen1
Occasional Contributor III

HI

I'm hoping someone can shed some light on how widget config files are supposed to work. I'm extending existing widgets and creating new ones, and I found that I can't reference values in the config.json files (in the widget folder), either in widget.html or widget.js. My dev environment is using the pattern of writing code in source control, and using grunt to copy files to the sever. Using tools found in this esri git repo. After poking around at the deployed app, I see that the config.json file is not being used. The app is actually configured to use a config file like "...\server\apps\2\configs\FilterDateTime\config_widgets_FilterDateTime_Widget_21.json", which is not getting updated via my grunt task.

Is this expected? Not really documented - esri docs just make it seem like you edit the config.json file in the widget folder and that's it.

And not easy to manage, with the grunt task referenced above.

It looks like I can modify the the app config so that it uses the config.json file in the widget folder, but not sure that is advisable. I'm assuming the  way this is set up is meant to optimize performance.

Any clarification about this and about best practices for managing these config files would be appreciated.

Thanks

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Conlen,

How does that happen, and how does it get updated?

When you add a widget to your app WAB copies the widgets config.json into the apps configs folder automatically. When you make a change in the widget settings dialog those changes are added to the apps configs json file specific to that widget. You will not have to make any manual edits to this file unless you just choose to do so. You will want your Grunt task to edit the json file in the apps configs folder and ignore the config.json in the widgets folder as it is no longer used. 

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Conlen,


  The config being copied to the apps config a folder is the expected behavior. The config in the widgets folder is just the template that gets copied to the apps config folder. The nice thing about the app using the config folder is all widgets configs are locates in one place.

0 Kudos
ZorbaConlen1
Occasional Contributor III

Ok. Yes it does seem handy to have all configs in one spot. I guess my confusion is with this statement - "The config in the widgets folder is just the template that gets copied to the apps config folder" - How does that happen, and how does it get updated? Do I have to manually edit that file? Or set up my grunt task to update that file when I edit the config.json file in source control?

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Conlen,

How does that happen, and how does it get updated?

When you add a widget to your app WAB copies the widgets config.json into the apps configs folder automatically. When you make a change in the widget settings dialog those changes are added to the apps configs json file specific to that widget. You will not have to make any manual edits to this file unless you just choose to do so. You will want your Grunt task to edit the json file in the apps configs folder and ignore the config.json in the widgets folder as it is no longer used. 

0 Kudos
ZorbaConlen1
Occasional Contributor III

Got it. Thanks.

0 Kudos