in filter, for single condition, replace disabled remove button with clear button
This commit is contained in:
parent
3becce1667
commit
f7599f3b30
1 changed files with 13 additions and 4 deletions
|
@ -450,16 +450,25 @@ Ox.Filter = function(options, self) {
|
||||||
var isGroup = subpos == -1 && self.options.query.conditions[pos].conditions;
|
var isGroup = subpos == -1 && self.options.query.conditions[pos].conditions;
|
||||||
return Ox.merge([
|
return Ox.merge([
|
||||||
Ox.Button({
|
Ox.Button({
|
||||||
disabled: self.options.query.conditions.length == 1,
|
|
||||||
id: 'remove',
|
id: 'remove',
|
||||||
title: 'remove',
|
title: self.options.query.conditions.length == 1
|
||||||
|
? 'close' : 'remove',
|
||||||
type: 'image'
|
type: 'image'
|
||||||
})
|
})
|
||||||
.css({margin: '0 4px 0 ' + (isGroup ? '292px' : '8px')}) // fixme: 296 is probably correct, but labels seem to be too wide
|
.css({margin: '0 4px 0 ' + (isGroup ? '292px' : '8px')}) // fixme: 296 is probably correct, but labels seem to be too wide
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
click: function(data) {
|
click: function(data) {
|
||||||
Ox.Log('Form', 'remove...', data)
|
var key;
|
||||||
if (data._element.parent().data('subposition') == -1) {
|
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'));
|
removeCondition(data._element.parent().data('position'));
|
||||||
} else {
|
} else {
|
||||||
removeCondition(
|
removeCondition(
|
||||||
|
|
Loading…
Reference in a new issue