diff --git a/source/Ox.UI/js/Form/Ox.Filter.js b/source/Ox.UI/js/Form/Ox.Filter.js index f786a9ca..8faa6715 100644 --- a/source/Ox.UI/js/Form/Ox.Filter.js +++ b/source/Ox.UI/js/Form/Ox.Filter.js @@ -66,7 +66,11 @@ Ox.Filter = function(options, self) { {id: '<', title: 'is less than'}, {id: '>', title: 'is greater than'}, {id: '-', title: 'is between'}, - {id: '!-', title: 'is not between'} + {id: '!-', title: 'is not between'}/*, + {id: '^', title: 'starts with'}, + {id: '!^', title: 'does not start with'}, + {id: '$', title: 'ends with'}, + {id: '!$', title: 'does not end with'}*/ ], string: [ {id: '=', title: 'is'}, @@ -356,9 +360,9 @@ Ox.Filter = function(options, self) { : [self.options.query.conditions[pos].conditions[subpos]], isUseless = false; Ox.forEach(conditions, function(condition) { - isUseless = Ox.getObjectById( - self.options.findKeys, condition.key - ).type == 'text' + isUseless = ['string', 'text'].indexOf( + Ox.getObjectById(self.options.findKeys, condition.key).type + ) > -1 && condition.operator == (self.options.query.operator == '&' ? '' : '!') && condition.value == '' return isUseless; diff --git a/source/Ox.UI/js/Form/Ox.Select.js b/source/Ox.UI/js/Form/Ox.Select.js index 5d0e7335..6fbf758f 100644 --- a/source/Ox.UI/js/Form/Ox.Select.js +++ b/source/Ox.UI/js/Form/Ox.Select.js @@ -196,7 +196,7 @@ Ox.Select = function(options, self) { that.selectItem = function(id) { //Ox.print('selectItem', id, Ox.getObjectById(self.options.items, id).title) self.options.type == 'text' && self.$title.html( - Ox.getObjectById(self.options.items, id).title[0] // fixme: title should not have become an array + Ox.getObjectById(self.options.items, id).title ); self.$menu.checkItem(id); self.checked = self.optionGroup.checked(); diff --git a/source/Ox.js b/source/Ox.js index aec3cb7e..9df7114b 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -434,12 +434,12 @@ Ox.clone Returns a (shallow or deep) copy of an object or array @*/ Ox.clone = function(col, deep) { - var ret; + // fixme: is there any use case for shallow copy? + var ret = Ox.isArray(col) ? [] : {}; if (deep) { - ret = Ox.isArray(col) ? [] : {}; Ox.forEach(col, function(val, key) { ret[key] = ['array', 'object'].indexOf(Ox.typeOf(val)) > -1 - ? Ox.clone(val) : val; + ? Ox.clone(val, true) : val; }); } else { ret = Ox.isArray(col) ? col.slice() : Ox.extend({}, col); @@ -700,6 +700,7 @@ Ox.isEmpty Returns true if a collection is empty true @*/ Ox.isEmpty = function(val) { + // fixme: what about deep isEmpty? return Ox.len(val) == 0; }; @@ -4233,11 +4234,15 @@ Ox.serialize Parses an object into query parameters 'a=1&b=2&c=3' > Ox.serialize({a: 1, b: 2.3, c: [4, 5]}) 'a=1&b=2.3&c=4,5' + > Ox.serialize({string: 'foo', empty: {}, null: null, undefined: void 0}) + 'string=bar' @*/ Ox.serialize = function(obj) { var arr = []; Ox.forEach(obj, function(val, key) { - arr.push(key + '=' + val); + if (!Ox.isEmpty(val) && !Ox.isNull(val) && !Ox.isUndefined(val)) { + arr.push(key + '=' + val); + } }); return arr.join('&'); };