diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 1a537bee..02826265 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -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) { diff --git a/demos/test/list.js b/demos/test/list.js index ab2bd2c2..10f30a50 100644 --- a/demos/test/list.js +++ b/demos/test/list.js @@ -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; }