Select to view content in your preferred language

Widget not rendering on reopen.

1120
7
11-10-2016 11:43 AM
JacobNosal
Deactivated User

I am developing a custom WAB widget that needs to coexist with other widgets in the same application. Currently, I have two widgets, call them A and B respectively. 

  •   Open widget A > close widget A > open widget B > console error: "dojo/parser::parse() error Error: Tried to register widget with id==_5 but that id is already registered(…)" >close widget B > open widget A > html doesn't render, events are registered.
  • Open widget B > close widget B > open widget A > console error: "dojo/parser::parse() error Error: Tried to register widget with id==_5 but that id is already registered(…)" > close widget A > open widget B > no errors are encountered and widget works as desired.

Has anyone experienced a similar problem?

Regards,

Jacob Nosal

0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus

Jacob,

   It sounds like you are using dom ids in your widget.html instead of data-dojo-attach-point like you should in templated widgets.

0 Kudos
JacobNosal
Deactivated User

Thanks Robert. Ids are used in widget B. Would that cause widget A to not render?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Could. You should not use dom ids in any templated widget development.

0 Kudos
JacobNosal
Deactivated User

I just purged dom ids from widget B and am having the same problem.Can you recommend a style guide or template structure wiki?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

WAB widgets use the dojo templated widgets Structure. So search for dojo templated widget tutorial. You can also zip up your widgets and I will look them  over for you.

0 Kudos
JacobNosal
Deactivated User

I have used the Yeoman generator esri-appbuilder-js:widget from the ESRI github. Would that give me the appropriate template? I am reading about the structure of a dojo templated widget right now.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jacob,


   Yes I would totally expect it to give you the proper structure. But when you add to the Widget.html you just need to maintain the same practices (meaning no use of don ids). And there is many more best practices when it comes to the Widget.js (like this.own and lang.hitch, etc).

0 Kudos