From 09487ad04341c053ee3773a9371ddb00d1a29d66 Mon Sep 17 00:00:00 2001 From: mikl <> Date: Thu, 3 Jul 2008 17:24:50 +0000 Subject: Added Autocomplete page to quickstart --- .../pages/ActiveControls/AutoComplete.page | 18 +++++++ .../protected/pages/ActiveControls/Home.page | 4 +- .../ActiveControls/Samples/TAutoComplete/Home.page | 57 ++++++++++++++++++++++ .../ActiveControls/Samples/TAutoComplete/Home.php | 34 +++++++++++++ 4 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 demos/quickstart/protected/pages/ActiveControls/AutoComplete.page create mode 100644 demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.page create mode 100644 demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php (limited to 'demos') diff --git a/demos/quickstart/protected/pages/ActiveControls/AutoComplete.page b/demos/quickstart/protected/pages/ActiveControls/AutoComplete.page new file mode 100644 index 00000000..14af4af7 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/AutoComplete.page @@ -0,0 +1,18 @@ + + +

TAutoComplete

+ + +

+TAutoComplete is an extended ActiveTextBox that provides a list of suggestions on the current partial word typed in the textbox. The suggestions are requested using callbacks. The Frequency and MinChars properties sets the delay and minimum number of characters typed, respectively, before requesting for sugggestions. An embedded TRepeater is used to Display the list of suggestions. It can be accessed and styled through the Suggestions property and its sub-properties.

+ +

+On each request for suggestions, the OnSuggestion event will be raised. The event handler receives the entered token that can be used to build the list of suggestions and to dataBind() it to the Suggestions repeater.

+ +

+When a suggestion is selected the OnSuggestionSelected event is raised, with the index of the selected suggestion contained in the parameter. Multiple selections can be performed in the same textbox. The selections must be separated by any characters specified with the Separator property. +

+ + + +
$Id$
diff --git a/demos/quickstart/protected/pages/ActiveControls/Home.page b/demos/quickstart/protected/pages/ActiveControls/Home.page index 1dad48a4..5cf4ab17 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Home.page @@ -132,7 +132,7 @@ TActiveButton control. See also the later part of the
  • - * TAutoComplete + TAutoComplete extends TActiveTextBox to offer text completion suggestions.
  • @@ -357,4 +357,4 @@ realize the active controls.

    -
    $Id$
    \ No newline at end of file +
    $Id$
    diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.page new file mode 100644 index 00000000..6f566364 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.page @@ -0,0 +1,57 @@ + + + + + +

    TAutoComplete Sample (AJAX)

    + + + + + + + +
    +Simple Autocompleter: + + + + +
  • <%# $this->Data['name'] %>
  • +
    +
    + +
    +Autocompleter with multiple selection: + + + + +
  • <%# $this->Data['name'] %>
  • +
    +
    +(Use ',' to separate the selected suggestions) + +
    + + + +
    $Id$
    diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php new file mode 100644 index 00000000..ca8a9e59 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php @@ -0,0 +1,34 @@ +getToken(); + // Sender is the Suggestions repeater + $sender->DataSource=$this->getDummyData($token); + $sender->dataBind(); + } + + public function suggestionSelected1($sender,$param) { + $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ]; + $this->Selection1->Text='Selected ID: '.$id; + } + + public function suggestionSelected2($sender,$param) { + $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ]; + $this->Selection2->Text='Selected ID: '.$id; + } + + public function getDummyData($token) { + // You would look for matches to the given token here + return array( + array('id'=>1, 'name'=>'John'), + array('id'=>2, 'name'=>'Paul'), + array('id'=>3, 'name'=>'George'), + array('id'=>4, 'name'=>'Ringo') + ); + } +} + +?> -- cgit v1.2.3