Edit of custom widget not reflected in WAB

679
5
Jump to solution
11-15-2017 12:04 PM
TyroneLigon1
New Contributor III

WAB 2.5 - as an experiment, I copied the "Simple" widget from the "samplewidgets" folder to the "widgets" folder and made the necessary edit to config.json. I then created a new application and added the "Simple" widget to the app. I then edited the Widget.js file (replaced the word "very" with "ridiculously"), then refreshed the app. The change did not display. I then cleared the browser cache, edited the app by deleting the widget from the app, saving the app, re-adding the widget, and saving the app again. The change did not display. I then added the widget to a new application, and that's when the change showed up in the widget.

During development, you constantly update the interface and modules (unless you're THAT talented), so how do you edit a widget that's under development? I guess I can go into "server/apps/appId/widgets/customWidget" and edit files there, then transfer the edits when I've finished development back to the widget folder in "widgets", but that just seems like a backwards way to do development.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Tyrone,

   What you are calling backwards way of doing it is the best workflow based on the WAB core design. The best thing is to understand the way WAB is built. It is based on the stem cell concept. You have the stemapp with has a certain genetic sequence (core source code) when you create a new app that stemapp is cloned (copied) to the new app. The clone is now a copy of the stemapp and is no longer linked in any way. So for a change that you make to the stemapp widgets to be seen normally a new app has to be created (so that a new clone is made). There is a workflow that you can use that will allow you to debug the stemapp changes directly but I have found it cumbersome. That workflow is to add your widget to a custom .json file (ie. config-widget-testing.json) in the stemapp sample-configs folder and then use a url like this:

http ://localhost:3344/webappviewer/index.html?config=sample-configs/config-widget-testing.json

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Emeritus

Tyrone,

   What you are calling backwards way of doing it is the best workflow based on the WAB core design. The best thing is to understand the way WAB is built. It is based on the stem cell concept. You have the stemapp with has a certain genetic sequence (core source code) when you create a new app that stemapp is cloned (copied) to the new app. The clone is now a copy of the stemapp and is no longer linked in any way. So for a change that you make to the stemapp widgets to be seen normally a new app has to be created (so that a new clone is made). There is a workflow that you can use that will allow you to debug the stemapp changes directly but I have found it cumbersome. That workflow is to add your widget to a custom .json file (ie. config-widget-testing.json) in the stemapp sample-configs folder and then use a url like this:

http ://localhost:3344/webappviewer/index.html?config=sample-configs/config-widget-testing.json

TyroneLigon1
New Contributor III

I saw that approach in another page, although I didn't realize it was for development purposes. I used the config-demo config file and got an error in the map manager script line 384: "Item does not exist or is inaccessible." I edited the config file to point to our portal and geometry service. When I tried to debug the script, it seemed to be picking up the default Portal map, so I'm unsure what item the script can't find.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Tyrone,

   I just created a copy of the sample-configs\config-demo.json and change the portalUrl and geometryService urls and the itemId to mine and ran webappviewer and did not get any error. Did you possibly create syntax error in the json?

0 Kudos
TyroneLigon1
New Contributor III

Think I found the issue in the config-demo file: a hard coded map ID. I'll get back to you.

0 Kudos
TyroneLigon1
New Contributor III

The issue was a map item ID; once I changed that value to one of our Portal maps, I was able to open the Demo Widgets app. I then edited one of the widgets in the "samplewidgets" folder and the edit showed up when I refreshed the app. Thanks.

0 Kudos