Dojo: issue with NumberSpinner

I created this NumberSpinner widget:

<input name="form_action_fy" id="form_action_fy" value="2010" data-dojo-type="dijit.form.NumberSpinner" data-dojo-smallDelta="1" data-dojo-largeDelta="1" data-dojo-constraints="{min:2010,max:2030,places:0}" /> 

When I load the page, the widget shows as expected. However, there are several problems:

  • The value is empty, not 2010.

  • When I click on the decrease button on an empty widget, I get 9000000000000000, and when I increase on an empty widget, I get -9000000000000000. He does not follow the min / max guidelines.

  • Both Little Delta and Big Delta do not work either.

What am I doing wrong here?

Thanks Eric

+4
source share
1 answer

In the new style of the widget attribute, the properties passed to the constructor function are placed in the data-dojo-props attribute instead of ad-hoc attributes. In cases where documents still point to an older declarative style, you might be better off looking for examples of programming style examples.

 <input name="form_action_fy" id="form_action_fy" data-dojo-type="dijit.form.NumberSpinner" data-dojo-props=" value:2010, smallDelta:5, largeDelta:10, constraints:{min:2010,max:2200,places:0}" /> 

Real-time example: http://jsfiddle.net/missingno/cQfFt/

Please note that in Dojo 1.6 a couple of widgets are still in the process of transition, so some attributes can be duplicated in the form of prop and attribute. Things should be ok in 1.7 though.

+4
source

Source: https://habr.com/ru/post/1379201/


All Articles