hello all,I am beginner for dojo coding,and I am trying to develop widgets with dojo,and I want to have recursive function in one of my widgets that can be executed n times and return the values (0 to n-1) on each call of the function,so,is there anyone who has know how to solve this problem with dojo and share me? thanks in advance.
Awet,
First just to be sure you know. AGOL version of WAB does not allow for adding or using custom widget. WAB Dev edition is the only one that will allow you to add custom widgets and themes.
Now as far as your question. A function that returns a value is simple and most all functions can be called recursively. So a WAB widget function would look like this:
myFunction: function(inputVal){
var newVal;
newVal = inputVal + 3;
return newVal;
},
you can look at otb widgets in the widgets folder for best practice coding and ideas. Widget development is not exactly like standard JS coding and be sure to understand AMD coding style.
There are widget development walkthroughs on the WEB Dev site: Create a custom in-panel widget—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developer...
And dojo templated widget coding Creating Template-based Widgets - Archived Tutorial - Dojo Toolkit
Robert,
Thank you very much for your fundamental directions toward the point,but,let me clear with my question: my intention is to have function with for loop or any loop statement and that loop has counter,then the function must return every value of the counter,which means,as soon as the value of counter is updated the function must be called.
Awet
Awet,
It looks like you figured this question out based on your other post.