add disableButtons and enableButtons methods to Ox.Dialog
This commit is contained in:
parent
ec7ec4d707
commit
4c641db867
2 changed files with 19 additions and 1 deletions
|
@ -75,7 +75,12 @@ Ox.Form = function(options, self) {
|
||||||
},
|
},
|
||||||
validate: function(data) {
|
validate: function(data) {
|
||||||
validate(i, data.valid);
|
validate(i, data.valid);
|
||||||
|
// timeout needed for cases where the form is removed
|
||||||
|
// from the DOM, triggering blur of an empty item -
|
||||||
|
// in this case, we don't want the message to appear
|
||||||
|
setTimeout(function() {
|
||||||
self.$items[i].setMessage(data.valid ? '' : data.message);
|
self.$items[i].setMessage(data.valid ? '' : data.message);
|
||||||
|
}, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -688,11 +688,23 @@ Ox.Dialog = function(options, self) {
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.disableButtons = function() {
|
||||||
|
self.options.buttons.forEach(function(button) {
|
||||||
|
!Ox.isEmpty(button) && button.options({disabled: true});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
that.enableButton = function(id) {
|
that.enableButton = function(id) {
|
||||||
getButtonById(id).options({disabled: false});
|
getButtonById(id).options({disabled: false});
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.enableButtons = function() {
|
||||||
|
self.options.buttons.forEach(function(button) {
|
||||||
|
!Ox.isEmpty(button) && button.options({disabled: false});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
that.open = function() {
|
that.open = function() {
|
||||||
self.initialHeight = self.options.height;
|
self.initialHeight = self.options.height;
|
||||||
self.initialWidth = self.options.width;
|
self.initialWidth = self.options.width;
|
||||||
|
@ -723,6 +735,7 @@ Ox.Dialog = function(options, self) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
that.triggerEvent('open');
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue