Open a widget from another widget

4976
14
Jump to solution
07-28-2016 02:22 AM
Naveen_KumarKairamkonda
Occasional Contributor


How to open a widget from another widget. I have a scenario like, After getting the resulted location in map(Search widget) it should open the Identify widget. Which of the files need to be edited in both widgets.

Thanks in advance.

0 Kudos
14 Replies
Ángel_DanielSuárez_Calero
New Contributor III

I get my purpose I have a code here :

https://drive.google.com/open?id=1hF2fthqX8Ogc74HeUt2fGM4dXrNhgcvu 

Thanks for all Robert  ! 

0 Kudos
Naveen_KumarKairamkonda
Occasional Contributor

Hi Robert,

Thank You very much for such a kind support !!!

Now I am able to open the the draw widget after getting the results from search widget. But  there are few error in console while opening the draw widget.

Error: Tried to register widget with id==widgets_Draw_Widget_35_panel but that id is already registered (2 times)

Error: Uncaught TypeError: Cannot read property 'started' of undefined (2 times)

Also attached the screenshot for the same for better understanding.ConsoleError.png

Regards,

Ibrahim

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Ibrahim,

So it turns out that the code to open the draw widget in the TabTheme should be:

     _openDrawWidget: function() {

          var drawWidget, sbc;

          var widgetCfg = this._getWidgetConfig('Draw');

          if (widgetCfg) {

              sbc = WidgetManager.getInstance().getWidgetsByName("SidebarController")[0];

              sbc._resizeToMax();

              sbc.setOpenedIds([widgetCfg.id]);

          }

      }

View solution in original post

Naveen_KumarKairamkonda
Occasional Contributor

Thanks Robert.

the problem got resolved.

Thanks again....

0 Kudos
Naveen_KumarKairamkonda
Occasional Contributor

Hi,

    I have a scenario like, when I search for an area in map, it should automatically open the Identify widget along with the resulted area in Map. As per the requirement I'm able open Identify Widget along with the resulted area, but Sometimes only

I'm getting an ERROR like: 

     " init.js:199 Error: Tried to register widget with id==widgets_Identify_Widget_33_panel but
       that id is already registered(…) "Error: Tried to register widget with
       id==widgets_Identify_Widget_33_panel but that id is already registered
      at Error
      (native)
      at Object.add (https://js.arcgis.com/3.16/init.js:1658:391)
      at create
       (https://js.arcgis.com/3.16/init.js:1280:472)......"   

If there is NO ERROR, it's showing like:

" panel [widgets_Identify_Widget_33_panel] created.
Widget.js:261 <font color='#000000'><em>
[attribname]</em></font>: <font color='#000000'>[attribvalue]</font><br>
WidgetManager.js:115 widget [widgets/Identify/Widget] created. "

Here, I'm attaching the screenshot of ERROR.

So, please suggest me what should be done.

Thanks in advance...

Regards,

Ibrahim

0 Kudos