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:
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
Solved! Go to Solution.
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.
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.