phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
TableTrait.php
Go to the documentation of this file.
1<?php
3
5
12
13 abstract public function addEvent($event, $jsCode, $stopPropagation = false, $preventDefault = false);
14
15 abstract public function getOn($event, $url, $responseElement = "", $parameters = array());
16
17 protected function addToPropertyTable($property, $value) {
18 return $this->_self->addToProperty($property, $value);
19 }
20
21 public function setCelled() {
22 return $this->addToPropertyTable("class", "celled");
23 }
24
25 public function setBasic($very = false) {
26 $table = $this->_self;
27 if ($very)
28 $table->addToPropertyCtrl("class", "very", array(
29 "very"
30 ));
31 return $table->addToPropertyCtrl("class", "basic", array(
32 "basic"
33 ));
34 }
35
36 public function setCompact($very = false) {
37 $table = $this->_self;
38 if ($very)
39 $table->addToPropertyCtrl("class", "very", array(
40 "very"
41 ));
42 return $table->addToPropertyCtrl("class", "compact", array(
43 "compact"
44 ));
45 }
46
47 public function setCollapsing() {
48 return $this->addToPropertyTable("class", "collapsing");
49 }
50
51 public function setDefinition() {
52 return $this->addToPropertyTable("class", "definition");
53 }
54
55 public function setStructured() {
56 return $this->addToPropertyTable("class", "structured");
57 }
58
59 public function setSortable($colIndex = NULL) {
60 $table = $this->_self;
61 if (isset($colIndex) && $table->hasPart("thead")) {
62 $table->getHeader()->sort($colIndex);
63 }
64 return $table->addToProperty("class", "sortable");
65 }
66
67 public function setSingleLine() {
68 return $this->addToPropertyTable("class", "single line");
69 }
70
71 public function setFixed() {
72 return $this->addToPropertyTable("class", "fixed");
73 }
74
75 public function setSelectable() {
76 return $this->addToPropertyTable("class", "selectable");
77 }
78
79 public function setStriped() {
80 return $this->addToPropertyTable("class", "striped");
81 }
82
83 public function onRowClick($jsCode, $stopPropagation = false, $preventDefault = false) {
84 return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault);
85 }
86
87 public function onRow($event, $jsCode, $stopPropagation = false, $preventDefault = false) {
88 return $this->_self->addEvent($event . "{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault);
89 }
90
91 public function getOnRow($event, $url, $responseElement = "", $parameters = array()) {
92 $activeClass = $this->_self->getActiveRowClass();
93 $jsCondition = '(!$(this).closest("tr").hasClass("' . $activeClass . '") || event.target.tagName === "TR")';
94 if (isset($parameters['jsCondition'])) {
95 $jsCondition = '(' . $parameters['jsCondition'] . ' && ' . $jsCondition . ')';
96 }
97 $parameters = \array_merge($parameters, [
98 "stopPropagation" => false,
99 "preventDefault" => false,
100 "jsCondition" => $jsCondition
101 ]);
102 $selector = "tbody tr";
103 if (isset($parameters["selector"])) {
104 $selector = $parameters["selector"];
105 }
106 return $this->_self->getOn($event . "{{" . $selector . "}}", $url, $responseElement, $parameters);
107 }
108
109 public function onPageChange($jsCode) {
110 $this->_self->_addEvent("pageChange", $jsCode);
111 return $this;
112 }
113
114 public function onSearchTerminate($jsCode) {
115 $this->_self->_addEvent("searchTerminate", $jsCode);
116 return $this;
117 }
118
119 public function getEventsScript() {
120 return $this->_self->getBsComponent()->getScript();
121 }
122
123 public function addEventsOnRun(JsUtils $js = NULL) {
124 $script = parent::addEventsOnRun($js);
125 $innerScript = $this->_self->getInnerScript();
126 if (! isset($innerScript)) {
127 $this->_self->setInnerScript($script);
128 }
129 return $script;
130 }
131}
JQuery PHP library.
Definition JsUtils.php:23
getOn($event, $url, $responseElement="", $parameters=array())
onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false)
addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false)
getOnRow($event, $url, $responseElement="", $parameters=array())
onRowClick($jsCode, $stopPropagation=false, $preventDefault=false)