trigger change event in filter
This commit is contained in:
parent
d50e37588b
commit
211884740d
3 changed files with 41 additions and 20 deletions
|
@ -275,6 +275,7 @@ Ox.Filter = function(options, self) {
|
|||
self.options.query.conditions[pos].conditions.splice(subpos, 0, condition);
|
||||
}
|
||||
renderConditions();
|
||||
triggerChangeEvent();
|
||||
}
|
||||
|
||||
function changeConditionKey(pos, subpos, key) {
|
||||
|
@ -295,6 +296,7 @@ Ox.Filter = function(options, self) {
|
|||
renderConditions();
|
||||
//self.$conditions[pos].replaceElement(1, constructConditionOperator(pos, oldOperator));
|
||||
}
|
||||
triggerChangeEvent();
|
||||
}
|
||||
|
||||
function changeConditionOperator(pos, subpos, operator) {
|
||||
|
@ -312,6 +314,15 @@ Ox.Filter = function(options, self) {
|
|||
condition.value = condition.value[0]
|
||||
renderConditions();
|
||||
}
|
||||
triggerChangeEvent();
|
||||
}
|
||||
|
||||
function changeConditionValue(pos, subpos, value) {
|
||||
var condition = subpos == -1
|
||||
? self.options.query.conditions[pos]
|
||||
: self.options.query.conditions[pos].conditions[subpos];
|
||||
condition.value = value;
|
||||
triggerChangeEvent();
|
||||
}
|
||||
|
||||
function changeOperator(data) {
|
||||
|
@ -324,6 +335,7 @@ Ox.Filter = function(options, self) {
|
|||
}
|
||||
});
|
||||
changeGroupOperator && renderConditions();
|
||||
triggerChangeEvent();
|
||||
}
|
||||
|
||||
function getConditionType(type) {
|
||||
|
@ -343,6 +355,7 @@ Ox.Filter = function(options, self) {
|
|||
self.options.query.conditions[pos].conditions.splice(subpos, 1);
|
||||
}
|
||||
renderConditions();
|
||||
triggerChangeEvent();
|
||||
}
|
||||
|
||||
function renderButtons(pos, subpos) {
|
||||
|
@ -435,10 +448,10 @@ Ox.Filter = function(options, self) {
|
|||
})
|
||||
.bindEvent({
|
||||
change: function(data) {
|
||||
Ox.print('changeKey', data)
|
||||
var $element = data._element.parent();
|
||||
changeConditionKey(
|
||||
data._element.parent().data('position'),
|
||||
data._element.parent().data('subposition'),
|
||||
$element.data('position'),
|
||||
$element.data('subposition'),
|
||||
data.selected[0].id
|
||||
);
|
||||
}
|
||||
|
@ -462,9 +475,10 @@ Ox.Filter = function(options, self) {
|
|||
})
|
||||
.bindEvent({
|
||||
change: function(data) {
|
||||
var $element = data._element.parent();
|
||||
changeConditionOperator(
|
||||
data._element.parent().data('position'),
|
||||
data._element.parent().data('subposition'),
|
||||
$element.data('position'),
|
||||
$element.data('subposition'),
|
||||
data.selected[0].id
|
||||
);
|
||||
}
|
||||
|
@ -485,14 +499,12 @@ Ox.Filter = function(options, self) {
|
|||
})
|
||||
).bindEvent({
|
||||
change: function(data) {
|
||||
var $element = data._element.parent(),
|
||||
pos = $element.data('position'),
|
||||
subpos = $element.data('subposition');
|
||||
if (subpos == -1) {
|
||||
self.options.query.conditions[pos].value = data.value;
|
||||
} else {
|
||||
self.options.query.conditions[pos].conditions[subpos].value = data.value;
|
||||
}
|
||||
var $element = data._element.parent();
|
||||
changeConditionValue(
|
||||
$element.data('position'),
|
||||
$element.data('subposition'),
|
||||
data.value
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -645,6 +657,12 @@ Ox.Filter = function(options, self) {
|
|||
return $input;
|
||||
}
|
||||
|
||||
function triggerChangeEvent() {
|
||||
that.triggerEvent('change', {
|
||||
query: self.options.query
|
||||
});
|
||||
}
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
|
|
|
@ -150,7 +150,7 @@ Ox.Range = function(options, self) {
|
|||
|
||||
function clickTrack(data) {
|
||||
// fixme: thumb ends up a bit too far on the right
|
||||
var isThumb = $(edatatarget).hasClass('OxThumb');
|
||||
var isThumb = $(data.target).hasClass('OxThumb');
|
||||
self.drag = {
|
||||
left: self.$track.offset().left,
|
||||
offset: isThumb ? data.clientX - self.$thumb.offset().left - 8 /*self.thumbSize / 2*/ : 0
|
||||
|
|
|
@ -237,18 +237,21 @@ Ox.Dialog = function(options, self) {
|
|||
|
||||
function drag(event) {
|
||||
Ox.print(document.body.scrollTop, '...')
|
||||
var left = Ox.limit(
|
||||
var left, top;
|
||||
if (!$(event.target).is('.OxButton')) {
|
||||
left = Ox.limit(
|
||||
self.drag.left - self.drag.x + event.clientX,
|
||||
self.minLeft, self.maxLeft
|
||||
),
|
||||
);
|
||||
top = Ox.limit(
|
||||
self.drag.top - self.drag.y + event.clientY,
|
||||
self.minTop, self.maxTop
|
||||
);
|
||||
setCSS({
|
||||
left: left,
|
||||
top: top
|
||||
});
|
||||
setCSS({
|
||||
left: left,
|
||||
top: top
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function dragend() {
|
||||
|
|
Loading…
Reference in a new issue