forked from 0x2620/oxjs
improving listmap
This commit is contained in:
parent
c86c7d598d
commit
5915acd72c
12 changed files with 152 additions and 39 deletions
|
|
@ -131,7 +131,12 @@ Ox.ArrayInput = function(options, self) {
|
|||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'width') {
|
||||
if (key == 'value') {
|
||||
return Ox.map(self.$input, function($input) {
|
||||
var value = $input.value();
|
||||
return value === '' ? null : value;
|
||||
});
|
||||
} else if (key == 'width') {
|
||||
setWidths();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ Ox.Form = function(options, self) {
|
|||
});
|
||||
});
|
||||
|
||||
function getItemPositionById(id) {
|
||||
function getItemIndexById(id) {
|
||||
return self.itemIds.indexOf(id);
|
||||
}
|
||||
|
||||
|
|
@ -121,8 +121,10 @@ Ox.Form = function(options, self) {
|
|||
//Ox.print('VALUES', values)
|
||||
return values;
|
||||
} else {
|
||||
Ox.each(arguments[0], function(val, key) {
|
||||
|
||||
Ox.forEach(arguments[0], function(value, key) {
|
||||
var index = getItemIndexById(key);
|
||||
index > -1 && Ox.print(key, value)
|
||||
index > -1 && self.options.items[index].options({value: value});
|
||||
});
|
||||
return that;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -789,8 +789,10 @@ Ox.Input = function(options, self) {
|
|||
} else if (key == 'placeholder') {
|
||||
setPlaceholder();
|
||||
} else if (key == 'value') {
|
||||
val = self.$input.val(); // fixme: ??
|
||||
self.$input.val(value);
|
||||
if (self.options.type == 'float' && self.options.decimals) {
|
||||
self.options.value = self.options.value.toFixed(self.options.decimals);
|
||||
}
|
||||
self.$input.val(self.options.value);
|
||||
setPlaceholder();
|
||||
} else if (key == 'width') {
|
||||
that.css({width: self.options.width + 'px'});
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ Ox.Select = function(options, self) {
|
|||
// fixme: selected item needs attribute "checked", not "selected" ... that's strange
|
||||
var self = self || {},
|
||||
that = new Ox.Element({
|
||||
tooltip: options.tooltip || {}
|
||||
tooltip: options.tooltip || ''
|
||||
}, self) // fixme: do we use 'div', or {}, or '', by default?
|
||||
.defaults({
|
||||
id: '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue