Filter: introduce timeout (still does not work as expected)
This commit is contained in:
parent
6bad3345da
commit
e763541eea
1 changed files with 20 additions and 12 deletions
|
@ -490,15 +490,20 @@ Ox.Filter = function(options, self) {
|
|||
.css({margin: '0 ' + (subpos == -1 ? '4px' : '0') + ' 0 4px'})
|
||||
.bindEvent({
|
||||
click: function(data) {
|
||||
Ox.Log('Form', 'add...', data, this.$element.parent().data('position'), this.$element.parent().data('subposition'))
|
||||
if (this.$element.parent().data('subposition') == -1) {
|
||||
addCondition(this.$element.parent().data('position') + 1);
|
||||
var that = this;
|
||||
// timeout needed so that input change registers
|
||||
// before all conditions are re-rendered
|
||||
setTimeout(function() {
|
||||
Ox.Log('Form', 'add...', data, that.$element.parent().data('position'), that.$element.parent().data('subposition'))
|
||||
if (that.$element.parent().data('subposition') == -1) {
|
||||
addCondition(that.$element.parent().data('position') + 1);
|
||||
} else {
|
||||
addCondition(
|
||||
this.$element.parent().data('position'),
|
||||
this.$element.parent().data('subposition') + 1
|
||||
that.$element.parent().data('position'),
|
||||
that.$element.parent().data('subposition') + 1
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
], subpos == -1 ? [
|
||||
|
@ -511,7 +516,10 @@ Ox.Filter = function(options, self) {
|
|||
.css({margin: '0 0 0 4px'})
|
||||
.bindEvent({
|
||||
click: function(data) {
|
||||
addCondition(this.$element.parent().data('position') + 1, -1, true)
|
||||
var that = this;
|
||||
setTimeout(function() {
|
||||
addCondition(that.$element.parent().data('position') + 1, -1, true)
|
||||
});
|
||||
}
|
||||
})
|
||||
] : []);
|
||||
|
|
Loading…
Reference in a new issue