I made a copy of the Search widget to use on a different layer. I renamed the copy Search.js file to Search2.js, Search.html to Search2.html and referenced it like so in config/viewer.js:

   search2: {
            include: true,
            id: 'search2',
            type: 'titlePane',
            canFloat: true,
            path: 'gis/dijit/Search2',
            title: 'Find Precinct',
            open: true,
            position: 3,
            options: {
                map: true,
                mapClickMode: true,
                mapRightClickMenu: true
            }
        },

I changed the id of the selection box in the js and html copies to "mySelectp."

I get an error in the browser:

dojo/parser::parse() error Error: Tried to register widget with id==mySelect but that id is already registered

I can't figure out why the Search2 widget is seemingly still trying to reference the element with id==mySelect, instead of the renamed id==mySelectp.

Fixed. I had not changed the define statement at the beginning, so the copy of the widget was still pointing at the original files, thus the attempt to register id==mySelect which was already registered.

With the viewer.js file edited to point at the copy correctly, I only failed to change the define statement and the initialization in the main function. Now it works.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.