use pcrud auto-complete widget when selecting providers
authorgmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 18 Nov 2010 16:28:21 +0000 (16:28 +0000)
committergmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 18 Nov 2010 16:28:21 +0000 (16:28 +0000)
Fixes general slowness working with invoice and PO forms if
more than a couple hundred providers are defined.

This could be generalized with a bit of work with Fieldmapper
to define "has-one-chosen-by-user-from-cast-of-thousands"
relationships that should trigger use the auto-complete widget.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
git-svn-id: svn://svn.open-ils.org/ILS/trunk@18785 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js

index 3fff2b1..eec578d 100644 (file)
@@ -405,6 +405,8 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                 return this._buildOrgSelector();
             if(linkClass == 'acpl')
                 return this._buildCopyLocSelector();
+            if(linkClass == 'acqpro')
+                return this._buildAutoCompleteSelector(linkClass, vfield.selector);
 
 
             dojo.require('dojo.data.ItemFileReadStore');
@@ -651,6 +653,17 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
             });
 
             return true;
+        },
+
+        _buildAutoCompleteSelector : function(linkClass, searchAttr) {
+            dojo.require("openils.widget.PCrudAutocompleteBox");
+            dojo.mixin(this.dijitArgs, {
+                fmclass : linkClass,
+                searchAttr : searchAttr,
+            });
+            this.widget = new openils.widget.PCrudAutocompleteBox(this.dijitArgs, this.parentNode);
+            this._widgetLoaded();
+            return true;
         }
     });