From ddc3ea15bbfd0235fe90f3b2211bf4cc605e25d6 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 13 May 2006 00:21:16 +0000 Subject: Adding TCallbackOptions --- .../pages/ActiveControls/ActiveControl.page | 7 ++++++- .../pages/ActiveControls/AutoComplete.page | 24 +++++++++++++++++++--- .../pages/ActiveControls/AutoComplete.php | 23 ++++++++++++++++++--- 3 files changed, 47 insertions(+), 7 deletions(-) (limited to 'tests/FunctionalTests') diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page index fab91c40..260ee805 100644 --- a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page @@ -1,7 +1,12 @@

TCallback Demo

+ + diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.page b/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.page index f0d78267..9d85b3fa 100644 --- a/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.page +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.page @@ -2,15 +2,33 @@ - +



diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php b/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php index 81508000..3474234e 100644 --- a/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php @@ -5,13 +5,30 @@ class AutoComplete extends TPage { - public function suggestEmails($sender, $param) + public function suggestCountries($sender, $param) { - $words = array('hello', 'world'); - $sender->setDataSource($words); + $sender->setDataSource($this->matchCountries($param->getParameter())); $sender->dataBind(); $sender->render($param->getOutput()); } + + protected function matchCountries($token) + { + $info = Prado::createComponent('System.I18N.core.CultureInfo', 'en'); + $list = array(); + $count = 0; + $token = strtolower($token); + foreach($info->getCountries() as $country) + { + if(strpos(strtolower($country), $token) === 0) + { + $list[] = $country; + $count++; + if($count > 10) break; + } + } + return $list; + } } ?> \ No newline at end of file -- cgit v1.2.3