Author: musachy
Date: Sat Feb 24 08:25:27 2007
New Revision: 511297
URL: http://svn.apache.org/viewvc?view=rev&rev=511297
Log:
WW-1589 Linked autocompleter reset on page reload
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java?view=diff&rev=511297&r1=511296&r2=511297
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Div.java
Sat Feb 24 08:25:27 2007
@@ -69,15 +69,15 @@
* 'formFilter' is the name of a function which will be used to filter the
fields that will be
* seralized. This function takes as a parameter the element and returns true
if the element
* should be included.<p/>
- * 'updateFreq' sets(in milliseconds) the update interval.
- * 'autoStart' if set to true(true by default) starts the timer automatically
- * 'startTimerListenTopics' is a comma-separated list of topics used to start
the timer
- * 'stopTimerListenTopics' is a comma-separated list of topics used to stop
the timer
- * 'listenTopics' comma separated list of topics names, that will trigger a
request
- * 'indicator' element to be shown while the request executing
+ * 'updateFreq' sets(in milliseconds) the update interval.<p/>
+ * 'autoStart' if set to true(true by default) starts the timer
automatically<p/>
+ * 'startTimerListenTopics' is a comma-separated list of topics used to start
the timer<p/>
+ * 'stopTimerListenTopics' is a comma-separated list of topics used to stop
the timer<p/>
+ * 'listenTopics' comma separated list of topics names, that will trigger a
request<p/>
+ * 'indicator' element to be shown while the request executing<p/>
* 'showErrorTransportText': whether errors should be displayed (on
'targets')</p>
* 'showLoadingText' show loading text on targets</p>
- * 'notifyTopics' comma separated list of topics names, that will be
published. Three parameters are passed:
+ * 'notifyTopics' comma separated list of topics names, that will be
published. Three parameters are passed:<p/>
* <ul>
* <li>data: html or json object when type='load' or type='error'</li>
* <li>type: 'before' before the request is made, 'load' when the request
succeeds, or 'error' when it fails</li>
Modified:
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js?view=diff&rev=511297&r1=511296&r2=511297
==============================================================================
---
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js
(original)
+++
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js
Sat Feb 24 08:25:27 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"
});