make find work in list demo
This commit is contained in:
parent
85d4ea4f8b
commit
4aaf7d6f35
|
@ -2024,7 +2024,10 @@ requires
|
|||
function submit() {
|
||||
Ox.print("input submit", that.$input.val())
|
||||
that.$input.trigger("blur");
|
||||
that.triggerEvent("submit", that.$input.val());
|
||||
that.triggerEvent("submit", self.option ? {
|
||||
key: self.option.id,
|
||||
value: that.$input.val()
|
||||
} : that.$input.val());
|
||||
}
|
||||
|
||||
that.height = function(value) {
|
||||
|
|
|
@ -441,6 +441,32 @@ $(function() {
|
|||
$loadingIcon.stop();
|
||||
});
|
||||
|
||||
Ox.Event.bind(null, "submit_find", function(event, data) {
|
||||
findCondition = {
|
||||
key: data.key == "all" ? "" : data.key,
|
||||
value: data.value,
|
||||
operator: "~"
|
||||
};
|
||||
$.each(groups, function(i, group) {
|
||||
$group[i].options({
|
||||
request: function(options) {
|
||||
delete options.keys;
|
||||
return app.request("find", $.extend(options, {
|
||||
group: group.id,
|
||||
query: constructQuery(group.id)
|
||||
}), options.callback);
|
||||
}
|
||||
});
|
||||
});
|
||||
$list.options({
|
||||
request: function(options) {
|
||||
return app.request("find", $.extend(options, {
|
||||
query: constructQuery()
|
||||
}), options.callback);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$.each(groups, function(i, group) {
|
||||
Ox.Event.bind(null, "select_group_" + group.id, function(event, data) {
|
||||
$list.options({
|
||||
|
@ -452,7 +478,6 @@ $(function() {
|
|||
operator: "="
|
||||
};
|
||||
});
|
||||
Ox.print
|
||||
return app.request("find", $.extend(options, {
|
||||
query: constructQuery()
|
||||
}), options.callback);
|
||||
|
@ -468,7 +493,7 @@ $(function() {
|
|||
query: constructQuery(group_.id)
|
||||
}), options.callback);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -515,7 +540,7 @@ $(function() {
|
|||
});
|
||||
|
||||
function constructQuery(groupId) {
|
||||
var conditions = $.merge(!Ox.isUndefined(findCondition.query) ? [findCondition] : [], $.map(groups, function(v, i) {
|
||||
var conditions = $.merge(!Ox.isUndefined(findCondition.key) ? [findCondition] : [], $.map(groups, function(v, i) {
|
||||
if (v.id != groupId) {
|
||||
return v.conditions;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user