|
@@ -16,17 +16,17 @@ discard block |
|
|
block discarded – undo |
|
16
|
16
|
parent::__construct($identifier, $model, $modelInstance); |
|
17
|
17
|
} |
|
18
|
18
|
|
|
19
|
|
- protected function _generateContent($table){ |
|
|
19
|
+ protected function _generateContent($table) { |
|
20
|
20
|
$this->_addRowModel($table); |
|
21
|
21
|
$this->_rowClass="_json"; |
|
22
|
22
|
parent::_generateContent($table); |
|
23
|
23
|
} |
|
24
|
24
|
|
|
25
|
|
- protected function _addRowModel($table){ |
|
|
25
|
+ protected function _addRowModel($table) { |
|
26
|
26
|
$object=JReflection::jsonObject($this->_model); |
|
27
|
|
- $row=$this->_generateRow($object, $table,"_jsonArrayChecked"); |
|
|
27
|
+ $row=$this->_generateRow($object, $table, "_jsonArrayChecked"); |
|
28
|
28
|
$row->setClass($this->_modelClass); |
|
29
|
|
- $row->addToProperty("style","display:none;"); |
|
|
29
|
+ $row->addToProperty("style", "display:none;"); |
|
30
|
30
|
$table->getBody()->_addRow($row); |
|
31
|
31
|
} |
|
32
|
32
|
|
|
@@ -34,22 +34,22 @@ discard block |
|
|
block discarded – undo |
|
34
|
34
|
* {@inheritDoc} |
|
35
|
35
|
* @see DataTable::_associatePaginationBehavior() |
|
36
|
36
|
*/ |
|
37
|
|
- protected function _associatePaginationBehavior(HtmlMenu $menu,JsUtils $js=NULL){ |
|
|
37
|
+ protected function _associatePaginationBehavior(HtmlMenu $menu, JsUtils $js=NULL) { |
|
38
|
38
|
$callback=null; |
|
39
|
|
- if(isset($js)){ |
|
|
39
|
+ if (isset($js)) { |
|
40
|
40
|
$id=$this->identifier; |
|
41
|
41
|
$offset=$js->scriptCount(); |
|
42
|
42
|
$this->run($js); |
|
43
|
43
|
$callback=$js->getScript($offset); |
|
44
|
|
- $callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
|
|
44
|
+ $callback.=$js->trigger("#".$id." [name='selection[]']", "change", false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
|
45
|
45
|
$callback.=";var page=parseInt($(self).attr('data-page')); |
|
46
|
46
|
$('#pagination-{$id} .item').removeClass('active'); |
|
47
|
47
|
$('#pagination-{$id} [data-page='+page+']:not(.no-active)').addClass('active'); |
|
48
|
48
|
$('#pagination-{$id} ._firstPage').attr('data-page',Math.max(1,page-1)); |
|
49
|
49
|
var lastPage=$('#pagination-{$id} ._lastPage');lastPage.attr('data-page',Math.min(lastPage.attr('data-max'),page+1));"; |
|
50
|
50
|
} |
|
51
|
|
- if(isset($this->_urls["refresh"])) |
|
52
|
|
- $this->jsonArrayOnClick($menu, $this->_urls["refresh"],"post","{'p':$(this).attr('data-page')}",$callback); |
|
|
51
|
+ if (isset($this->_urls["refresh"])) |
|
|
52
|
+ $this->jsonArrayOnClick($menu, $this->_urls["refresh"], "post", "{'p':$(this).attr('data-page')}", $callback); |
|
53
|
53
|
} |
|
54
|
54
|
|
|
55
|
55
|
/** |
|
@@ -60,29 +60,29 @@ discard block |
|
|
block discarded – undo |
|
60
|
60
|
* @param callable $jsCallback |
|
61
|
61
|
* @return AjaxCall |
|
62
|
62
|
*/ |
|
63
|
|
- public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){ |
|
64
|
|
- $parameters=\array_merge($parameters,["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass,"url"=>$url,"method"=>$method,"params"=>$params,"jsCallback"=>$jsCallback]); |
|
|
63
|
+ public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) { |
|
|
64
|
+ $parameters=\array_merge($parameters, ["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass, "url"=>$url, "method"=>$method, "params"=>$params, "jsCallback"=>$jsCallback]); |
|
65
|
65
|
return new AjaxCall("jsonArray", $parameters); |
|
66
|
66
|
} |
|
67
|
67
|
|
|
68
|
|
- public function jsClear(){ |
|
|
68
|
+ public function jsClear() { |
|
69
|
69
|
return "$('#{$this->identifier} tbody').find('._json').remove();"; |
|
70
|
70
|
} |
|
71
|
71
|
|
|
72
|
|
- public function clearOn(BaseHtml $element,$event, $stopPropagation=false, $preventDefault=false){ |
|
73
|
|
- return $element->addEvent($event, $this->jsClear(),$stopPropagation,$preventDefault); |
|
|
72
|
+ public function clearOn(BaseHtml $element, $event, $stopPropagation=false, $preventDefault=false) { |
|
|
73
|
+ return $element->addEvent($event, $this->jsClear(), $stopPropagation, $preventDefault); |
|
74
|
74
|
} |
|
75
|
75
|
|
|
76
|
|
- public function clearOnClick(BaseHtml $element,$stopPropagation=false, $preventDefault=false){ |
|
77
|
|
- return $this->clearOn($element, "click",$stopPropagation,$preventDefault); |
|
|
76
|
+ public function clearOnClick(BaseHtml $element, $stopPropagation=false, $preventDefault=false) { |
|
|
77
|
+ return $this->clearOn($element, "click", $stopPropagation, $preventDefault); |
|
78
|
78
|
} |
|
79
|
79
|
|
|
80
|
|
- public function jsonArrayOn(BaseHtml $element,$event,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){ |
|
81
|
|
- return $element->_addEvent($event, $this->jsJsonArray($url,$method,$params,$jsCallback,$parameters)); |
|
|
80
|
+ public function jsonArrayOn(BaseHtml $element, $event, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) { |
|
|
81
|
+ return $element->_addEvent($event, $this->jsJsonArray($url, $method, $params, $jsCallback, $parameters)); |
|
82
|
82
|
} |
|
83
|
83
|
|
|
84
|
|
- public function jsonArrayOnClick(BaseHtml $element,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){ |
|
85
|
|
- return $this->jsonArrayOn($element, "click", $url,$method,$params,$jsCallback,$parameters); |
|
|
84
|
+ public function jsonArrayOnClick(BaseHtml $element, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) { |
|
|
85
|
+ return $this->jsonArrayOn($element, "click", $url, $method, $params, $jsCallback, $parameters); |
|
86
|
86
|
} |
|
87
|
87
|
|
|
88
|
88
|
/** |
|
@@ -93,7 +93,7 @@ discard block |
|
|
block discarded – undo |
|
93
|
93
|
* @param number $pages_visibles The number of visible pages in the Pagination component |
|
94
|
94
|
* @return DataTable |
|
95
|
95
|
*/ |
|
96
|
|
- public function paginate($page,$total_rowcount,$items_per_page=10,$pages_visibles=null){ |
|
97
|
|
- return parent::paginate($page, $total_rowcount,$items_per_page,null); |
|
|
96
|
+ public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) { |
|
|
97
|
+ return parent::paginate($page, $total_rowcount, $items_per_page, null); |
|
98
|
98
|
} |
|
99
|
99
|
} |
|
100
|
100
|
\ No newline at end of file |