]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dijit/form/NumberSpinner.js
add Dojo 1.1.1
[eow] / static / dojo-release-1.1.1 / dijit / form / NumberSpinner.js
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:
13         // extends NumberTextBox to add up/down arrows for incremental change to the value
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 }