summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js13
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js35
-rw-r--r--framework/Web/Javascripts/prado/activecontrols/activecontrols3.js35
4 files changed, 72 insertions, 12 deletions
diff --git a/HISTORY b/HISTORY
index 0a191f45..c5865343 100644
--- a/HISTORY
+++ b/HISTORY
@@ -12,6 +12,7 @@ BUG: Ticket#549 - set/get Timestamp on TDatePicker shound handle "null" values (
BUG: Ticket#550 - explicitly include TCallbackClientSide in TCallbackOptions (Qiang)
BUG: Ticket#553 - I18N quickstart sample does not work (Qiang)
BUG: Ticket#555 - TNumberFormat throws exception (Qiang)
+BUG: Ticket#557 - TAutoComplete is not fool-proof (Wei)
BUG: Ticket#560 - TActiveImageButton broken (Postback instead of Callback) (Wei)
BUG: Ticket#573 - NumberFormat Bug (Wei)
BUG: Ticket#579 - The rating list lost its Javascript in changeset [1775] (Wei).
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index c1ce7504..cc967514 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -224,14 +224,19 @@ Event.stop(event);}});Prado.WebUI.TActiveRadioButton=Class.extend(Prado.WebUI.TA
Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));if(this.options['AutoPostBack']==true)
Event.observe(this.element,"change",this.doCallback.bindEvent(this,options));},doCallback:function(event,options)
{var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TAutoComplete=Class.extend(Autocompleter.Base,Prado.WebUI.TActiveTextBox.prototype);Prado.WebUI.TAutoComplete=Class.extend(Prado.WebUI.TAutoComplete,{initialize:function(options)
-{this.options=options;this.baseInitialize(options.ID,options.ResultPanel,options);Object.extend(this.options,{onSuccess:this.onComplete.bind(this)});if(options.AutoPostBack)
+{this.options=options;this.hasResults=false;this.baseInitialize(options.ID,options.ResultPanel,options);Object.extend(this.options,{onSuccess:this.onComplete.bind(this)});if(options.AutoPostBack)
this.onInit(options);},doCallback:function(event,options)
{if(!this.active)
{var request=new Prado.CallbackRequest(this.options.EventTarget,options);request.dispatch();Event.stop(event);}},onClick:function(event)
{var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();Event.fireEvent(this.element,"change");},getUpdatedChoices:function()
-{var options=new Array(this.getToken(),"__TAutoComplete_onSuggest__");Prado.Callback(this.options.EventTarget,options,null,this.options);},onComplete:function(request,boundary)
-{var result=Prado.Element.extractContent(request.transport.responseText,boundary);if(typeof(result)=="string"&&result.length>0)
-this.updateChoices(result);}});Prado.WebUI.TTimeTriggeredCallback=Base.extend({constructor:function(options)
+{var options=new Array(this.getToken(),"__TAutoComplete_onSuggest__");Prado.Callback(this.options.EventTarget,options,null,this.options);},selectEntry:function()
+{if(this.hasResults)
+{this.active=false;this.updateElement(this.getCurrentEntry());}},onComplete:function(request,boundary)
+{var result=Prado.Element.extractContent(request.transport.responseText,boundary);if(typeof(result)=="string")
+{if(result.length>0)
+{this.hasResults=true;this.updateChoices(result);}
+else
+{this.active=false;this.hasResults=false;this.hide();}}},});Prado.WebUI.TTimeTriggeredCallback=Base.extend({constructor:function(options)
{this.options=Object.extend({Interval:1},options||{});Prado.WebUI.TTimeTriggeredCallback.register(this);},startTimer:function()
{setTimeout(this.onTimerEvent.bind(this),100);if(typeof(this.timer)=='undefined'||this.timer==null)
this.timer=setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000);},stopTimer:function()
diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js
index 4b20a8de..1016f435 100644
--- a/framework/Web/Javascripts/js/debug/ajax.js
+++ b/framework/Web/Javascripts/js/debug/ajax.js
@@ -1978,6 +1978,7 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete,
initialize : function(options)
{
this.options = options;
+ this.hasResults = false;
this.baseInitialize(options.ID, options.ResultPanel, options);
Object.extend(this.options,
{
@@ -2014,12 +2015,38 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete,
Prado.Callback(this.options.EventTarget, options, null, this.options);
},
- onComplete : function(request, boundary)
+ /**
+ * Overrides parent implements, don't update if no results.
+ */
+ selectEntry: function()
+ {
+ if(this.hasResults)
+ {
+ this.active = false;
+ this.updateElement(this.getCurrentEntry());
+ }
+ },
+
+ onComplete : function(request, boundary)
{
var result = Prado.Element.extractContent(request.transport.responseText, boundary);
- if(typeof(result) == "string" && result.length > 0)
- this.updateChoices(result);
- }
+ if(typeof(result) == "string")
+ {
+ if(result.length > 0)
+ {
+ this.hasResults = true;
+ this.updateChoices(result);
+ }
+ else
+ {
+ this.active = false;
+ this.hasResults = false;
+ this.hide();
+ }
+ }
+ },
+
+
});
/**
diff --git a/framework/Web/Javascripts/prado/activecontrols/activecontrols3.js b/framework/Web/Javascripts/prado/activecontrols/activecontrols3.js
index bb61d8ea..86521ca3 100644
--- a/framework/Web/Javascripts/prado/activecontrols/activecontrols3.js
+++ b/framework/Web/Javascripts/prado/activecontrols/activecontrols3.js
@@ -98,6 +98,7 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete,
initialize : function(options)
{
this.options = options;
+ this.hasResults = false;
this.baseInitialize(options.ID, options.ResultPanel, options);
Object.extend(this.options,
{
@@ -134,12 +135,38 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete,
Prado.Callback(this.options.EventTarget, options, null, this.options);
},
- onComplete : function(request, boundary)
+ /**
+ * Overrides parent implements, don't update if no results.
+ */
+ selectEntry: function()
+ {
+ if(this.hasResults)
+ {
+ this.active = false;
+ this.updateElement(this.getCurrentEntry());
+ }
+ },
+
+ onComplete : function(request, boundary)
{
var result = Prado.Element.extractContent(request.transport.responseText, boundary);
- if(typeof(result) == "string" && result.length > 0)
- this.updateChoices(result);
- }
+ if(typeof(result) == "string")
+ {
+ if(result.length > 0)
+ {
+ this.hasResults = true;
+ this.updateChoices(result);
+ }
+ else
+ {
+ this.active = false;
+ this.hasResults = false;
+ this.hide();
+ }
+ }
+ },
+
+
});
/**