4 * TAutoComplete control.
6 Prado.WebUI.TAutoComplete = jQuery.klass(Autocompleter.Base, Prado.WebUI.TActiveTextBox.prototype,
8 initialize : function(options)
10 this.options = options;
11 this.observers = new Array();
12 this.hasResults = false;
13 this.baseInitialize(options.ID, options.ResultPanel, options);
14 Object.extend(this.options,
16 onSuccess : this.onComplete.bind(this)
19 if(options.AutoPostBack)
22 Prado.Registry[options.ID] = this;
25 doCallback : function(options, event)
29 var request = new Prado.CallbackRequest(this.options.EventTarget, options);
31 event.preventDefault();
35 //Overrides parent implementation, fires onchange event.
36 onClick: function(event)
38 var element = Event.findElement(event, 'LI');
39 this.index = element.autocompleteIndex;
42 jQuery(this.element).trigger('change');
45 getUpdatedChoices : function()
47 var options = new Array(this.getToken(),"__TAutoComplete_onSuggest__");
48 Prado.Callback(this.options.EventTarget, options, null, this.options);
52 * Overrides parent implements, don't update if no results.
54 selectEntry: function()
59 this.updateElement(this.getCurrentEntry());
60 var options = [this.index, "__TAutoComplete_onSuggestionSelected__"];
61 Prado.Callback(this.options.EventTarget, options, null, this.options);
65 onComplete : function(request, boundary)
67 var result = request.extractContent(boundary);
68 if(typeof(result) == "string")
72 this.hasResults = true;
73 this.updateChoices(result);
78 this.hasResults = false;