Copying existing widget with WAB Dev Edition

2222
5
Jump to solution
02-02-2016 07:40 AM
AaronManuel
New Contributor III

So I am trying to make some modifications to the layer list widget with WAB Developer edition. I'm going to modify just a few lines of code so that my widget doesn't show all the layers in the map, just the few I actually want to be on there.

I don't want to completely overwrite the original layerlist widget so I made a copy of the folder for the original LayerList widget, and pasted it back in as "LayerListSelect" . I modified the Widget.js for my "new" widget to reflect the new name. When I go to edit my app and add a new widget, both the original layerlist and my modified version show up with the same name, so I'm not sure which one I'm looking at.

I'm sure this is really simple and I've tried looking at the documentation, but I just don't know enough to see what I'm overlooking.

Thanks

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Aaron,

   Yes those are the standard files (possible including many files in a settings folder) but The LayerList widget has several more. No all of them do not but some may have the widget name in them so you need to do a quick check by searching for "LayerList". Do not change the baseClass property though or else you will have to make changes in the css files as well.

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Emeritus

Aaron,

    You need to make changes to the name in the manifest.json as well. And then go though each file and check in there is a hard coded widget name in the path (both the .js and .html files).

AaronManuel
New Contributor III

Thanks Robert. It looks to me like the files all the widgets have in common are: config.json, manifest.json, widget,html, and widget.js.

So all these have the widget name in them?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Aaron,

   Yes those are the standard files (possible including many files in a settings folder) but The LayerList widget has several more. No all of them do not but some may have the widget name in them so you need to do a quick check by searching for "LayerList". Do not change the baseClass property though or else you will have to make changes in the css files as well.

AaronManuel
New Contributor III

Thanks Robert, appreciate the info. I didn't see your second answer a few minutes ago, that is good to know. I will probably just try to modify the app copy of the widget.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Aaron,

   Another thing to consider is that when you create a app in WAB if copies the widget from the stemApp widget folder into your apps widgets folder. So if you modify the widget code in your apps widgets folder it will not affect the original widget in the stemApp folder (your just working with a copy).