1
0
Fork 0
forked from 0x2620/oxjs

updating form elements

This commit is contained in:
rolux 2011-12-30 15:03:01 +05:30
commit 73f1105692
13 changed files with 305 additions and 140 deletions

View file

@ -110,8 +110,7 @@ Ox.Select = function(options, self) {
width: getTitleWidth() + 'px'
})
.html(
self.options.title
|| getItem(self.options.value).title
self.options.title || getItem(self.options.value).title
)
.appendTo(that);
}
@ -153,14 +152,15 @@ Ox.Select = function(options, self) {
function changeMenu(data) {
self.options.value = self.optionGroup.value();
self.$title && self.$title.html(
self.options.title ? self.options.title : getItem(self.options.value).title
self.options.title || getItem(self.options.value).title
);
that.triggerEvent('change', {
title: Ox.isArray(self.options.value)
? self.options.value.map(function(value) {
return getItem(value).title;
})
: getItem(self.options.value).title,
title: Ox.isEmpty(self.options.value) ? ''
: Ox.isArray(self.options.value)
? self.options.value.map(function(value) {
return getItem(value).title;
})
: getItem(self.options.value).title,
value: self.options.value
});
}
@ -207,15 +207,13 @@ Ox.Select = function(options, self) {
self.$button.options({title: value});
}
} else if (key == 'width') {
Ox.Log('Form', 'SETTING WIDTH OPTION', value);
that.css({width: value - 2 + 'px'});
self.$title.css({width: getTitleWidth() + 'px'});
} else if (key == 'value') {
Ox.Log('Form', 'SETTING VALUE OPTION', value);
if (self.options.type == 'text' && !self.options.title) {
self.$title.html(getItem(value).title);
}
Ox.toArray(value).forEach(function(value) {
value !== '' && Ox.toArray(value).forEach(function(value) {
self.$menu.checkItem(value);
});
self.options.value = self.optionGroup.value();