From 3c03a42d1edb0ec26110ace00f42e156cabff67b Mon Sep 17 00:00:00 2001
From: wei <>
Date: Sat, 9 Dec 2006 09:17:22 +0000
Subject: Fixed #433, #384, #439, #477, #435, #422, #401, #359. Add more class
docs for sqlmap.
---
framework/Web/UI/ActiveControls/TAutoComplete.php | 32 +++++++++++++++--------
1 file changed, 21 insertions(+), 11 deletions(-)
(limited to 'framework/Web/UI/ActiveControls/TAutoComplete.php')
diff --git a/framework/Web/UI/ActiveControls/TAutoComplete.php b/framework/Web/UI/ActiveControls/TAutoComplete.php
index a886e732..07fa652b 100644
--- a/framework/Web/UI/ActiveControls/TAutoComplete.php
+++ b/framework/Web/UI/ActiveControls/TAutoComplete.php
@@ -36,18 +36,20 @@ Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');
* other properties of the repeater can be access via the {@link getSuggestions Suggestions}
* property (e.g. they can be set in the .page templates).
*
- * To return the list of suggestions back to the browser, in your {@link onSuggestion OnSuggestion}
- * event handler, do
+ * To return the list of suggestions back to the browser, supply a non-empty data source
+ * and call databind. For example,
*
* function autocomplete_suggestion($sender, $param)
* {
* $token = $param->getCallbackParameter(); //the partial word to match
* $sender->setDataSource($this->getSuggestionsFor($token)); //set suggestions
* $sender->dataBind();
- * $sender->render($param->getNewWriter()); //sends suggestion back to browser.
* }
*
*
+ * The suggestion will be rendered when the {@link dataBind()} method is called
+ * during a callback request.
+ *
* TAutoComplete allows multiple suggestions within one textbox with each
* word or phrase separated by any characters specified in the
* {@link setSeparator Separator} property. The {@link setFrequency Frequency}
@@ -168,6 +170,17 @@ class TAutoComplete extends TActiveTextBox implements INamingContainer
$this->getSuggestions()->setDataSource($data);
}
+ /**
+ * Overrides parent implementation. Callback {@link renderSuggestions()} when
+ * page's IsCallback property is true.
+ */
+ public function dataBind()
+ {
+ parent::dataBind();
+ if($this->getPage()->getIsCallback())
+ $this->renderSuggestions($this->getResponse()->createHtmlWriter());
+ }
+
/**
* @return TPanel suggestion results panel.
*/
@@ -232,24 +245,21 @@ class TAutoComplete extends TActiveTextBox implements INamingContainer
}
/**
- * Flush and returns the suggestions content back to the browser client.
+ * Renders the suggestions during a callback respones.
* @param THtmlWriter the renderer.
*/
- public function render($writer)
+ public function renderCallback($writer)
{
- if(!$this->getPage()->getIsCallback())
- parent::render($writer);
- if($this->getActiveControl()->canUpdateClientSide())
- $this->renderSuggestions($writer);
+ $this->renderSuggestions($writer);
}
/**
* Renders the suggestions repeater.
* @param THtmlWriter the renderer.
*/
- protected function renderSuggestions($writer)
+ public function renderSuggestions($writer)
{
- if($this->getSuggestions()->getItems()->getCount() > 0)
+ if($this->getActiveControl()->canUpdateClientSide())
{
$this->getSuggestions()->render($writer);
$boundary = $writer->getWriter()->getBoundary();
--
cgit v1.2.3