From 6fa60db796c979fe381bf20ea678d6338c4ad22b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 1 Aug 2011 14:04:24 -0400 Subject: [PATCH 1/1] AutoFieldWidget support for augmenting pcrud search options Adds a new searchOptions attribute to AutoFieldWidget for specifying additional parameters to pcrud when retrieving linked objects. The initial use case is for supporting a "select" list to allow AutoFieldWidget to retrieve only the display column of a linked object and not the whole object. Example: // fetch 'remote_field_name' on the remote objects instead of // fetching the entire object myGrid.overrideWidgetArgs.some_field = {searchOptions : {"select":{"some_hint":["remote_field_name"]}}}; Signed-off-by: Bill Erickson --- .../web/js/dojo/openils/widget/AutoFieldWidget.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js index e171f30d6b..858ae7010f 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js @@ -534,14 +534,15 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { oncomplete(openils.Util.readResponse(r, false, true)); }; + this.searchOptions = dojo.mixin( + {async : !this.forceSync, oncomplete : _cb}, + this.searchOptions + ); + if (this.searchFilter) { - new openils.PermaCrud().search(linkClass, this.searchFilter, { - async : !this.forceSync, oncomplete : _cb - }); + new openils.PermaCrud().search(linkClass, this.searchFilter, this.searchOptions); } else { - new openils.PermaCrud().retrieveAll(linkClass, { - async : !this.forceSync, oncomplete : _cb - }); + new openils.PermaCrud().retrieveAll(linkClass, this.searchOptions); } } } -- 2.43.2