AutoFieldWidget support for augmenting pcrud search options
authorBill Erickson <berick@esilibrary.com>
Mon, 1 Aug 2011 18:04:24 +0000 (14:04 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 1 Aug 2011 18:04:24 +0000 (14:04 -0400)
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 <berick@esilibrary.com>
Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js

index e171f30..858ae70 100644 (file)
@@ -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);
                     }
                 }
             }