svn commit: r1099244 - in /ofbiz/trunk/framework: images/webapp/images/fieldlookup.js images/webapp/images/selectall.js widget/config/widget.properties widget/templates/htmlFormMacroLibrary.ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1099244 - in /ofbiz/trunk/framework: images/webapp/images/fieldlookup.js images/webapp/images/selectall.js widget/config/widget.properties widget/templates/htmlFormMacroLibrary.ftl

jleroux@apache.org
Author: jleroux
Date: Tue May  3 21:03:11 2011
New Revision: 1099244

URL: http://svn.apache.org/viewvc?rev=1099244&view=rev
Log:
Default delay for ajaxAutoCompleter

Modified:
    ofbiz/trunk/framework/images/webapp/images/fieldlookup.js
    ofbiz/trunk/framework/images/webapp/images/selectall.js
    ofbiz/trunk/framework/widget/config/widget.properties
    ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl

Modified: ofbiz/trunk/framework/images/webapp/images/fieldlookup.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/fieldlookup.js?rev=1099244&r1=1099243&r2=1099244&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/fieldlookup.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/fieldlookup.js Tue May  3 21:03:11 2011
@@ -180,7 +180,7 @@ function initiallyCollapseDelayed() {
 /*************************************
 * Fieldlookup Class & Methods
 *************************************/
-function ConstructLookup(requestUrl, inputFieldId, dialogTarget, dialogOptionalTarget, formName, width, height, position, modal, ajaxUrl, showDescription, presentation, defaultMinLength, args) {
+function ConstructLookup(requestUrl, inputFieldId, dialogTarget, dialogOptionalTarget, formName, width, height, position, modal, ajaxUrl, showDescription, presentation, defaultMinLength, defaultDelay, args) {
     
     // add the presentation attribute to the request url to let the request know which decorator should be loaded
     if(!presentation) {
@@ -213,7 +213,7 @@ function ConstructLookup(requestUrl, inp
          SHOW_DESCRIPTION = showDescription;
         //write the new input box id in the ajaxUrl Array
         ajaxUrl = ajaxUrl.replace(ajaxUrl.substring(0, ajaxUrl.indexOf(",")), newInputBoxId);
-        new ajaxAutoCompleter(ajaxUrl, showDescription, defaultMinLength, formName);
+        new ajaxAutoCompleter(ajaxUrl, showDescription, defaultMinLength, defaultDelay, formName);
     }
     
     var positioning = null;

Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1099244&r1=1099243&r2=1099244&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Tue May  3 21:03:11 2011
@@ -389,7 +389,7 @@ function ajaxSubmitFormUpdateAreas(form,
  * form of: areaId, target, target parameters [, areaId, target, target parameters...].
 */
 
-function ajaxAutoCompleter(areaCsvString, showDescription, defaultMinLength, formName){
+function ajaxAutoCompleter(areaCsvString, showDescription, defaultMinLength, defaultDelay, formName){
     var areaArray = areaCsvString.replace(/&/g, '&').split(",");
     var numAreas = parseInt(areaArray.length / 3);
     
@@ -403,6 +403,7 @@ function ajaxAutoCompleter(areaCsvString
         
         jQuery("#" + div).autocomplete({
             minLength: defaultMinLength,
+            delay: defaultDelay,
             source: function(request, response){
                 jQuery.ajax({
                     url: url,

Modified: ofbiz/trunk/framework/widget/config/widget.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/config/widget.properties?rev=1099244&r1=1099243&r2=1099244&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/config/widget.properties (original)
+++ ofbiz/trunk/framework/widget/config/widget.properties Tue May  3 21:03:11 2011
@@ -33,6 +33,9 @@ widget.autocompleter.defaultViewSize=10
 # Default minimum number of characters an user has to type before the ajax autocompleter activates (jQuery default is 1)
 widget.autocompleter.defaultMinLength=2
 
+# Default delay in milliseconds the Autocomplete waits after a keystroke to activate itself. A zero-delay makes sense for local data (more responsive), but can produce a lot of load for remote data, while being less responsive.
+#widget.autocompleter.delay=300
+
 # Show/hide the ID field that is returned from ajax autocompleter
 widget.autocompleter.displayReturnField=Y
 

Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1099244&r1=1099243&r2=1099244&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Tue May  3 21:03:11 2011
@@ -66,7 +66,7 @@ under the License.
     /><#t/>
     <#if ajaxEnabled?has_content && ajaxEnabled>
         <#assign defaultMinLength = Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue("widget.properties", "widget.autocompleter.defaultMinLength")>
-        <script language="JavaScript" type="text/javascript">ajaxAutoCompleter('${ajaxUrl}', false, ${defaultMinLength!2});</script><#lt/>
+        <script language="JavaScript" type="text/javascript">ajaxAutoCompleter('${ajaxUrl}', false, ${defaultMinLength!2}, ${defaultDelay!300});</script><#lt/>
     </#if>
 </#macro>