From 6d52f5c4461bd26c4e1dea68686d88c71a9d3e22 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 21 Nov 2014 22:14:00 +0100 Subject: TJuiAutoComplete multiselection + quickstart doc implemented Separator, minChars and Frequency properties, added the related quickstart parts --- .../JuiControls/Samples/TJuiAutoComplete/Home.page | 45 ++++++++++++++++++++++ .../JuiControls/Samples/TJuiAutoComplete/Home.php | 39 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 demos/quickstart/protected/pages/JuiControls/Samples/TJuiAutoComplete/Home.page create mode 100644 demos/quickstart/protected/pages/JuiControls/Samples/TJuiAutoComplete/Home.php (limited to 'demos/quickstart/protected/pages/JuiControls/Samples/TJuiAutoComplete') diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiAutoComplete/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiAutoComplete/Home.page new file mode 100644 index 00000000..1338b651 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiAutoComplete/Home.page @@ -0,0 +1,45 @@ + +

TJuiAutoComplete Samples

+ + + + + + + + +
+Simple Autocompleter: + + + + +
  • <%# $this->Data['name'] %>
  • +
    +
    + +
    +Autocompleter with multiple selection: + + + + +
  • <%# $this->Data['name'] %>
  • +
    +
    +(Use ',' to separate the selected suggestions) + +
    + +
    diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiAutoComplete/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiAutoComplete/Home.php new file mode 100644 index 00000000..c3fba3a9 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiAutoComplete/Home.php @@ -0,0 +1,39 @@ +getToken(); + // Sender is the Suggestions repeater + $sender->DataSource=$this->suggestionsForName($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 suggestionsForName($name) { + $allChoices = array( + array('id'=>1, 'name'=>'John'), + array('id'=>2, 'name'=>'Paul'), + array('id'=>3, 'name'=>'George'), + array('id'=>4, 'name'=>'Ringo') + ); + + if($name) { + return array_filter($allChoices, function ($el) use ($name) { + return stripos($el['name'], $name) !== false; + }); + } else + return $allChoices; + } + +} \ No newline at end of file -- cgit v1.2.3