diff --git a/source/Ox.UI/js/Form/Ox.Filter.js b/source/Ox.UI/js/Form/Ox.Filter.js index 7bd13fef..754d8579 100644 --- a/source/Ox.UI/js/Form/Ox.Filter.js +++ b/source/Ox.UI/js/Form/Ox.Filter.js @@ -450,16 +450,25 @@ Ox.Filter = function(options, self) { var isGroup = subpos == -1 && self.options.query.conditions[pos].conditions; return Ox.merge([ Ox.Button({ - disabled: self.options.query.conditions.length == 1, id: 'remove', - title: 'remove', + title: self.options.query.conditions.length == 1 + ? 'close' : 'remove', type: 'image' }) .css({margin: '0 4px 0 ' + (isGroup ? '292px' : '8px')}) // fixme: 296 is probably correct, but labels seem to be too wide .bindEvent({ click: function(data) { - Ox.Log('Form', 'remove...', data) - if (data._element.parent().data('subposition') == -1) { + var key; + if (self.options.query.conditions.length == 1) { + key = self.options.findKeys[0]; + self.options.query.conditions = [{ + key: key.id, + value: '', + operator: self.conditionOperators[key.type][0].id + }]; + renderConditions(); + triggerChangeEvent(); + } else if (data._element.parent().data('subposition') == -1) { removeCondition(data._element.parent().data('position')); } else { removeCondition(