1
0
Fork 0
forked from 0x2620/oxjs

improve form elements

This commit is contained in:
rlx 2011-11-02 10:23:15 +00:00
commit 14a6b6c148
5 changed files with 43 additions and 30 deletions

View file

@ -33,9 +33,9 @@ Ox.Checkbox = function(options, self) {
width: 'auto'
})
.options(options || {})
.addClass('OxCheckbox' +
(self.options.overlap == 'none' ? '' : ' OxOverlap' +
Ox.toTitleCase(self.options.overlap))
.addClass('OxCheckbox'
+ (self.options.overlap == 'none' ? '' : ' OxOverlap'
+ Ox.toTitleCase(self.options.overlap))
)
.attr({
disabled: self.options.disabled
@ -50,8 +50,7 @@ Ox.Checkbox = function(options, self) {
id: self.options.id + 'Label',
overlap: 'left',
title: self.options.title,
width: self.options.width - 16
- !!self.options.label * self.options.labelWidth
width: getTitleWidth()
})
.css({float: 'right'})
.click(clickTitle)
@ -100,6 +99,11 @@ Ox.Checkbox = function(options, self) {
!self.options.disabled && self.$button.trigger('click');
}
function getTitleWidth() {
return self.options.width - 16
- !!self.options.label * self.options.labelWidth;
}
self.setOption = function(key, value) {
if (key == 'checked') {
that.toggleChecked();
@ -109,6 +113,9 @@ Ox.Checkbox = function(options, self) {
self.$title && self.$title.options({disabled: value});
} else if (key == 'title') {
self.$title.options({title: value});
} else if (key == 'width') {
that.css({width: value + 'px'});
self.$title && self.$title.options({width: getTitleWidth()});
}
};