I need to create a custom widget that could calculate the value according to a model( function). For example, the user enters two values for the parameter a and b, then we need to display the result of f(a,b).
Is there any sample code to recommend?
Solved! Go to Solution.
Junxuan,
Here is a sample widget that just adds or multiplies to numbers from user input and displays the results in the widgets text.
Hi Junxuan,
I would suggest tagging the Web AppBuilder Custom Widgets place (or maybe moving your thread to that place).
Also, you could look through Robert Scheitlin, GISP 's Roberts Custom WAB Widgets
But, what you're asking for sounds pretty specific.
Hi Robert,
Thanks for your sample!
It works well in our web application. But when we copy the widget file to the samplewidgets files( follow the link:Create a custom in-panel widget—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developer... ), it can not work in the demo widget. The error is as follow:
Error: dijit._WidgetsInTemplateMixin: parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin. Must pre-load all supporting widgets before instantiation.
Thanks,
Junxuan
Junxuan,
Nothing in the samplewidgets folder is included by WAB as there is a specific file .repoignore that tells WAB to ignore any file in the samplewidgets folder.