How do I clone a widget and rename it differently?

2388
9
Jump to solution
01-20-2016 12:36 PM
haThach
New Contributor III

Hi Everyone,

Can someone guide me to the process of cloning a widget in the Web AppBuilder (Developer Edition). I can't seem to find a documentation to do this.

Thanks,

Ha

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Ha,

  1. You just copy the widgets folder and rename it to the widgets desired name.
  2. Open the manifest.json and change the widgets name there to match the folder name given in step 1
  3. Open the widget.js and if there is a name property in there replace that too.

View solution in original post

9 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Ha,

  1. You just copy the widgets folder and rename it to the widgets desired name.
  2. Open the manifest.json and change the widgets name there to match the folder name given in step 1
  3. Open the widget.js and if there is a name property in there replace that too.
haThach
New Contributor III

Thanks Robert.

I copy one of your eSearch widget and rename it to eSearchCust. Than I open both of the file you suggested and change these area highlighted in yellow.

1.png

Everything went well when I add the eSearchCust widget and save the update.

Now, when I launch the map, and click on the new widget. This is what I get...

3.png

I used fiddler and it seem to look in the widget/eSearch/List.js.

Does this make sense? Are there more files that I have to change?

4.png

Thanks,

Ha

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Ha,

   Yes with a widget as complicated as the eSearch there are going to be MANY more places in the code (*.js and *.html files) that the name eSearch is hard coded.

0 Kudos
FlorianCADOZ
Occasional Contributor

Hi Ha and Robert !

Regardless of the code of the widget, you must also add the widget name to list.json file to call it in the Builder and in the config.json in sample config for the developer side.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Florian,

  Actually No, I have never had to do that step as the builder will add it to that list automatically once it sees that there is new widget added.

0 Kudos
FlorianCADOZ
Occasional Contributor

oh ? So, sorry, maybe I have a problem in my WAB 'cause I always have to add it in the list.json...

0 Kudos
haThach
New Contributor III

Robert,

I search through all the files in the eSearch widget and found one additional file that I have to change. This seem to fix the issue that I'm having.

For those that might be interested to know....

5.png

Thanks,

Ha

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Ha,

   There are several more of these in the settings folder as well. Don't forget to mark this as answered.

0 Kudos
AlainMunyaneza1
New Contributor II

Hi Robert,

Hope You are well. We have tried to copy the Smart editor widget as many widgets and replaced all the file names. We still get the error same as Thach got above when you view the widget in web appbuilder. It brings this same error as Thach on pic

AlainMunyaneza1_0-1651155729270.png

 

0 Kudos