918f20927f624655737d5fdbacc2f74caf0e5c3f.svn-base 1.1 KB

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