You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2007/02/24 17:23:01 UTC

svn commit: r511295 - /struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js

Author: musachy
Date: Sat Feb 24 08:23:00 2007
New Revision: 511295

URL: http://svn.apache.org/viewvc?view=rev&rev=511295
Log:
WW-1589: Linked autocompleter reset on page reload

Modified:
    struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js

Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js
URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js?view=diff&rev=511295&r1=511294&r2=511295
==============================================================================
--- struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js (original)
+++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js Sat Feb 24 08:23:00 2007
@@ -21,6 +21,7 @@
 
   this.formId = "";
   this.formFilter = "";
+  this.firstRequest = true;
 
   this.cbox = null;
   this.init = function(/*Widget*/ cbox, /*DomNode*/ node){
@@ -59,10 +60,14 @@
       formNode: dojo.byId(this.formId),
       formFilter: window[this.formFilter],
       load: dojo.lang.hitch(this, function(type, data, evt) {
-         //show indicator
-         dojo.html.hide(this.cbox.indicator);
+        //show indicator
+        dojo.html.hide(this.cbox.indicator);
 
-        this.cbox.notify.apply(this.cbox, [data, type, evt]);
+        //if notifyTopics is published on the first request (onload)
+        //the value of listeners will be reset
+        if(!this.firstRequest) {
+          this.cbox.notify.apply(this.cbox, [data, type, evt]);
+        }
         if(!dojo.lang.isArray(data)) {
            //if there is a dataFieldName, take it
            if(!dojo.string.isBlank(this.cbox.dataFieldName) && data[this.cbox.dataFieldName] != null) {
@@ -87,6 +92,7 @@
            data = arrData;
         }
         this.setData(data);
+        this.firstRequest = false;
       }),
       mimetype: "text/json"
     });