Select to view content in your preferred language

calculate value according to a mathematical function

4914
4
Jump to solution
05-14-2016 06:43 AM
JunxuanZhao
Emerging Contributor

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?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Junxuan,

  Here is a sample widget that just adds or multiplies to numbers from user input and displays the results in the widgets text.

View solution in original post

4 Replies
AdrianWelsh
MVP Honored Contributor

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.

RobertScheitlin__GISP
MVP Emeritus

Junxuan,

  Here is a sample widget that just adds or multiplies to numbers from user input and displays the results in the widgets text.

JunxuanZhao
Emerging Contributor

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.

error.JPG

Thanks,

Junxuan

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

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.

0 Kudos