indeterminate checkboxes...

This commit is contained in:
rlx 2016-02-10 13:22:38 +05:30
parent 1472927883
commit 2944379b71

View file

@ -124,7 +124,7 @@ Ox.Button = function(options, self) {
if (!self.options.disabled) {
that.$tooltip && that.$tooltip.hide();
that.triggerEvent('click');
if (self.options.values.length > 1 || self.options.selectable) {
if (self.options.values.length || self.options.selectable) {
that.toggle();
that.triggerEvent('change', {value: self.options.value});
}
@ -196,7 +196,7 @@ Ox.Button = function(options, self) {
() -> <o> toggle button
@*/
that.toggle = function() {
if (self.options.values.length) {
if (self.options.values.length > 1) {
self.value = 1 - Ox.getIndexById(self.options.values, self.options.value);
self.options.title = self.options.values[self.value].title;
self.options.value = self.options.values[self.value].id;