TransWikia.com

Configurable Map Viewer: copy of Search widget fails to reference renamed id="mySelect2"

Geographic Information Systems Asked by user1532903 on January 25, 2021

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.

One Answer

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.

Answered by user1532903 on January 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP