Select to view content in your preferred language

Use code from Javascript API for a custom widget?

2119
2
03-09-2016 07:12 AM
JessicaKnight1
Occasional Contributor

I have a Javascript API application and I was wondering how to go about using some code from that to make a custom widget. I want to allow the user to select multiple layers to buffer and clip and it works great in the API. I have tried to do the same using a GP task in the Web App Builder, but my options using model builder seem to be that the user selects only one layer, or all layers are selected (combined into one) and the results are displayed with different symbology. In my API application, the user can check one, several, or all check boxes for layers to create the result. I'd like to offer the same tool with the App Builder. Is it a pretty easy copy paste situation? Or do I have to start from scratch? This is my first time really diving into the developer edition.

Thanks!

0 Kudos
2 Replies
JordanBaumgardner
Frequent Contributor

It's not cut and paste - but not terribly difficult either. Some JavaScipt skills are required. There is a great doc on creating your own custom widget that starts here: Naming conventions—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers

With the Widget framework it should be straight forward to plug it in.

RobertScheitlin__GISP
MVP Emeritus

Jessica,

   To add to Jordan's advice here is a thread where I took a JS sample and migrated that to a widget (full code). That example may help you on your way to doing the same for the API sample you want to convert.

How to use JS API Samples to Make WAB Widget?