Help with creating Widgets- ?

431
4
Jump to solution
02-05-2018 06:24 PM
AnnCrystal
New Contributor II

I am having a hard time understanding the creation of widgets even after going thru' both Dojo and ArcGIS JS widget creation tutorial. I created a widget for webmap- but I am stuck at writing Search widget as I am not sure about how map can be pulled into this widget. 

Instead of posting the code for my widget, I have put together a simple basic map using a portal webmap with a search functionality (Thanks to Robert for the Floating panel layerlist) as in this fiddle:

Edit fiddle - JSFiddle 

Could anybody please separate map and search as two different widgets  which will help me understand the concept? I'll be loading the widget's config from a json file. Any pointers will be helpful!! Thanks in advance 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Ann,

   Here is a zip that separates the Search widget from the map.js.

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Ann,

   Here is a zip that separates the Search widget from the map.js.

View solution in original post

AnnCrystal
New Contributor II

Awesome Robert- you are the most valuable mentor in this community. I was trying to separate it out as a widget which confused me a lot. This is easy to understand. But, what is the downside of avoiding widgeting in the dojo application? If I add more tool logic as separate js files and call it in the map without widgeting, are there any bottlenecks? Please share your thoughts. Thanks again.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Ann,

  For something as simple as the Search widget I would never separate it into its own js file unless there was some scenario where that component would not be added unless certain criteria/conditions existed (like a specific user group or individual should only see and use it). The bottleneck of not module-izing your code is that it can take longer to load and debug/maintain. Now if all the featrures are always going to be loaded and used then module-izing your code has less benefit. But if you can avoid loading say the layer list until it is requested/needed then you application will start faster.

AnnCrystal
New Contributor II

Thanks Robert for your support. 

0 Kudos