2150 |
mathias |
1 |
if(!dojo._hasResource["dijit.form.NumberSpinner"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
|
|
2 |
dojo._hasResource["dijit.form.NumberSpinner"] = true;
|
|
|
3 |
dojo.provide("dijit.form.NumberSpinner");
|
|
|
4 |
|
|
|
5 |
dojo.require("dijit.form._Spinner");
|
|
|
6 |
dojo.require("dijit.form.NumberTextBox");
|
|
|
7 |
|
|
|
8 |
dojo.declare(
|
|
|
9 |
"dijit.form.NumberSpinner",
|
|
|
10 |
[dijit.form._Spinner, dijit.form.NumberTextBoxMixin],
|
|
|
11 |
{
|
|
|
12 |
// summary: Number Spinner
|
|
|
13 |
// description: This widget is the same as NumberTextBox but with up/down arrows added
|
|
|
14 |
|
|
|
15 |
required: true,
|
|
|
16 |
|
|
|
17 |
adjust: function(/* Object */ val, /*Number*/ delta){
|
|
|
18 |
// summary: change Number val by the given amount
|
|
|
19 |
var newval = val+delta;
|
|
|
20 |
if(isNaN(val) || isNaN(newval)){ return val; }
|
|
|
21 |
if((typeof this.constraints.max == "number") && (newval > this.constraints.max)){
|
|
|
22 |
newval = this.constraints.max;
|
|
|
23 |
}
|
|
|
24 |
if((typeof this.constraints.min == "number") && (newval < this.constraints.min)){
|
|
|
25 |
newval = this.constraints.min;
|
|
|
26 |
}
|
|
|
27 |
return newval;
|
|
|
28 |
}
|
|
|
29 |
});
|
|
|
30 |
|
|
|
31 |
}
|