|
1
|
|
|
<?php |
|
2
|
|
|
namespace Ajax\semantic\components; |
|
3
|
|
|
|
|
4
|
|
|
use Ajax\JsUtils; |
|
5
|
|
|
|
|
6
|
|
|
class Dropdown extends SimpleSemExtComponent { |
|
7
|
|
|
|
|
8
|
|
|
public function __construct(JsUtils $js) { |
|
9
|
|
|
parent::__construct($js); |
|
10
|
|
|
$this->uiName = "dropdown"; |
|
11
|
|
|
} |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Sets a default action to occur |
|
15
|
|
|
* |
|
16
|
|
|
* @param string $action |
|
17
|
|
|
* one of "select","auto","activate","combo","nothing","hide" |
|
18
|
|
|
* @return \Ajax\semantic\components\Dropdown |
|
19
|
|
|
*/ |
|
20
|
|
|
public function setAction($action) { |
|
21
|
|
|
return $this->setParamCtrl("action", $action, array( |
|
22
|
|
|
"select", |
|
23
|
|
|
"auto", |
|
24
|
|
|
"activate", |
|
25
|
|
|
"combo", |
|
26
|
|
|
"nothing", |
|
27
|
|
|
"hide" |
|
28
|
|
|
)); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Define the event which trigger dropdown |
|
33
|
|
|
* |
|
34
|
|
|
* @param string $event |
|
35
|
|
|
* Event used to trigger dropdown (Hover, Click, Custom Event) |
|
36
|
|
|
* @return \Ajax\semantic\components\Dropdown |
|
37
|
|
|
*/ |
|
38
|
|
|
public function setOn($event) { |
|
39
|
|
|
return $this->setParam("on", $event); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function setFullTextSearch($value) { |
|
43
|
|
|
return $this->setParam("fullTextSearch", $value); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function setShowOnFocus($value) { |
|
47
|
|
|
return $this->setParam("showOnFocus", $value); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function setAllowAdditions($value) { |
|
51
|
|
|
return $this->setParam("allowAdditions", $value); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function setClearable($value) { |
|
55
|
|
|
return $this->setParam("clearable", $value); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function setOnAdd($value) { |
|
59
|
|
|
$this->params["onAdd"] = "%function(addedValue, addedText, \$addedChoice){" . $value . "}%"; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function setOnRemove($value) { |
|
63
|
|
|
$this->params["onRemove"] = "%function(removedValue, removedText, \$removedChoice){" . $value . "}%"; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|