misc fixes
This commit is contained in:
parent
33f08f3a41
commit
b881f74c7e
3 changed files with 18 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
13
source/Ox.js
13
source/Ox.js
|
@ -434,12 +434,12 @@ Ox.clone <f> 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 <f> 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 <f> 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('&');
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue