summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/ActiveControls/Samples
diff options
context:
space:
mode:
authormikl <>2008-07-03 17:24:50 +0000
committermikl <>2008-07-03 17:24:50 +0000
commit09487ad04341c053ee3773a9371ddb00d1a29d66 (patch)
treecd5bd99a72ea6b7f9c7a4ff241cf45400ddcacc6 /demos/quickstart/protected/pages/ActiveControls/Samples
parentdda2b12bff4859dcbd86334e7f65b101dba58166 (diff)
Added Autocomplete page to quickstart
Diffstat (limited to 'demos/quickstart/protected/pages/ActiveControls/Samples')
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.page57
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php34
2 files changed, 91 insertions, 0 deletions
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 @@
+<com:TContent ID="body">
+<!-- $Id$ -->
+
+<style type="text/css">
+<!--
+.acomplete { position: relative; z-index: 5; background-color: #EDF5FF; border: 1px solid #243356; }
+.acomplete ul, .acomplete li { margin: 0px; padding: 0px; list-style: none; color: #333; }
+.acomplete li { padding: 4px; border-top: 1px solid #ccc; }
+.acomplete .selected { background-color: #ffc; }
+-->
+</style>
+
+<h1>TAutoComplete Sample (AJAX)</h1>
+
+<table class="sampletable">
+
+<tr><td class="samplenote">
+Simple Autocompleter:
+</td><td class="sampleaction">
+<com:TAutoComplete
+ ID="AutoComplete"
+ OnSuggest="suggestNames"
+ OnSuggestionSelected="suggestionSelected1"
+ ResultPanel.CssClass="acomplete"
+ Suggestions.DataKeyField="id" >
+
+ <prop:Suggestions.ItemTemplate>
+ <li><%# $this->Data['name'] %></li>
+ </prop:Suggestions.ItemTemplate>
+</com:TAutoComplete>
+<com:TActiveLabel ID="Selection1" />
+</td></tr>
+
+<tr><td class="samplenote">
+Autocompleter with multiple selection:
+</td><td class="sampleaction">
+<com:TAutoComplete
+ ID="AutoComplete2"
+ OnSuggest="suggestNames"
+ OnSuggestionSelected="suggestionSelected2"
+ Separator=","
+ ResultPanel.CssClass="acomplete"
+ Suggestions.DataKeyField="id" >
+
+ <prop:Suggestions.ItemTemplate>
+ <li><%# $this->Data['name'] %></li>
+ </prop:Suggestions.ItemTemplate>
+</com:TAutoComplete>
+(Use ',' to separate the selected suggestions)
+<com:TActiveLabel ID="Selection2" />
+</td></tr>
+
+</table>
+
+<com:TJavascriptLogger />
+
+<div class="last-modified">$Id$</div></com:TContent>
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 @@
+<?php
+// $Id$
+class Home extends TPage
+{
+ public function suggestNames($sender,$param) {
+ // Get the token
+ $token=$param->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')
+ );
+ }
+}
+
+?>