ToggleButton.js 843 B

12345678910111213141516171819202122232425
  1. define("dojox/mobile/ToggleButton", [
  2. "dojo/_base/declare",
  3. "dojo/dom-class",
  4. "dijit/form/_ToggleButtonMixin",
  5. "./Button"
  6. ], function(declare, domClass, ToggleButtonMixin, Button){
  7. /*=====
  8. Button = dojox.mobile.Button;
  9. ToggleButtonMixin = dijit.form._ToggleButtonMixin;
  10. =====*/
  11. return declare("dojox.mobile.ToggleButton", [Button, ToggleButtonMixin], {
  12. // summary:
  13. // A non-templated button widget that can be in two states (checked or not).
  14. // Can be base class for things like tabs or checkbox or radio buttons
  15. baseClass: "mblToggleButton",
  16. _setCheckedAttr: function(){
  17. this.inherited(arguments);
  18. var newStateClasses = (this.baseClass+' '+this["class"]).replace(/(\S+)\s*/g, "$1Checked ").split(" ");
  19. domClass[this.checked ? "add" : "remove"](this.focusNode || this.domNode, newStateClasses);
  20. }
  21. });
  22. });