WW-1589 Linked autocompleter reset on page reload

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@511297 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Musachy Barroso
2007-02-24 16:25:27 +00:00
parent 847bf7dadd
commit 94c9d4f3d6
2 changed files with 16 additions and 10 deletions
@@ -69,15 +69,15 @@ import com.opensymphony.xwork2.util.ValueStack;
* '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>
@@ -21,6 +21,7 @@ struts.widget.ComboBoxDataProvider = function(/*Array*/ dataPairs, /*Number*/ li
this.formId = "";
this.formFilter = "";
this.firstRequest = true;
this.cbox = null;
this.init = function(/*Widget*/ cbox, /*DomNode*/ node){
@@ -59,10 +60,14 @@ struts.widget.ComboBoxDataProvider = function(/*Array*/ dataPairs, /*Number*/ li
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 @@ struts.widget.ComboBoxDataProvider = function(/*Array*/ dataPairs, /*Number*/ li
data = arrData;
}
this.setData(data);
this.firstRequest = false;
}),
mimetype: "text/json"
});