forked from 0x2620/oxjs
less obscure Ox.map
This commit is contained in:
parent
33390069b9
commit
12cf77cef5
21 changed files with 125 additions and 101 deletions
|
|
@ -67,8 +67,10 @@ Ox.SelectInput = function(options, self) {
|
|||
return value[value[0] == self.other ? 1 : 0]
|
||||
},
|
||||
split: function(value) {
|
||||
return Ox.map(self.options.items, function(item, i) {
|
||||
return i < item.length - 1 ? item.id : null;
|
||||
return Ox.filter(self.options.items, function(item, i) {
|
||||
return i < item.length - 1;
|
||||
}).map(function(item) {
|
||||
return item.id;
|
||||
}).indexOf(value) > -1 ? [value, ''] : [self.other, value];
|
||||
},
|
||||
width: self.options.width
|
||||
|
|
@ -89,8 +91,10 @@ Ox.SelectInput = function(options, self) {
|
|||
function setValue(isOther) {
|
||||
if (
|
||||
(!self.options.value && isOther !== true)
|
||||
|| Ox.map(self.options.items, function(item) {
|
||||
return item.id != self.other ? item.id : null;
|
||||
|| Ox.filter(self.options.items, function(item) {
|
||||
return item.id != self.other;
|
||||
}).map(function(item) {
|
||||
return item.id;
|
||||
}).indexOf(self.options.value) > -1
|
||||
) {
|
||||
self.$select.options({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue