I copied the Search widget into another directory named SearchTest to add some custom functionality. In this new widget, I changed the name in both manifest.json as well as in Widget.js, but when I go to add it in "Choose Widget" it still shows up as "Search" (now there are two "Search" widgets listed.) All my changes are working when I add the new widget to the map, I just can't figure out how to make it show up as "SearchTest."
Solved! Go to Solution.
In the repoitems file you will find i18nLabels object there you will likely find that your default label for your version of search is still named search. I think this might be becasue in the serch widget nls folder there is a _widgetLabel named "Search" try changing that and deleting the repoitems again.
Did you make those changes to the manifest.json and Widget.js in the stemApp folder or your specific apps folder or both?
I made the changes to the widget in the stemapp folder so it will show up as the correct name when I go to add a widget to an app.
I had to restart WAB (close out all the way, closing the cmd window as well, and restart) then I could see the change. I also added a label property to my manifest.json with "Search Test".
Very strange. I've restarted many times with no changes. I added the "label" property as well - nothing. I'm not finding where the manifest.json properties are fully documented. How did you know about "label," for example?
Other changes I make do show up, so I know I'm not mistakenly changing it in the wrong directory.
I sometimes run into an issue with having a custom widget show up twice in my widget list to fix this I go to the [install dir]\server\db folder and just delete the repoitems file (it will automatically be recreated). This should help you get past the search copy not picking up it's new label.
What I find is lack of documentation just means that as a developer I juts have to inspect the code and see what is actually used in code.
Yeah, that was something that I just noticed today as well -- widgets showing up multiple times. Unfortunately, deleting repoitems didn't do anything. Not sure what's happening.
I've had to find undocumented stuff that way quite a bit lately. Just wanted to make sure I wasn't missing some hard to find doc.
Thanks for your help.
Did you restart WAB after deleting the repoitems and then start a new app? I tested this and have used it a couple of times my self and it always works.
Yes, I restarted it and saw that it created a new repoitems file. I created a new app after restarting (closing browser and the server console, then restarting wab with the .bat)
Also, thinking that maybe it was somehow keeping track of a folder id or something, I tried creating a directory from scratch, then copied the files from Search into it. This new widget was showing up as the new name I gave it (in Widget.js, manifest.json). After deleting repoitems, this widget now shows up as "Search". Looking at repoItems, my new widgets appear to be named with my new names. It would probably be better to just create my widgets from scratch anyway.