|
@@ -22,25 +22,25 @@ discard block |
|
|
block discarded – undo |
|
22
|
22
|
$this->_rowClass="_json _element"; |
|
23
|
23
|
} |
|
24
|
24
|
|
|
25
|
|
- protected function _generateContent($table){ |
|
|
25
|
+ protected function _generateContent($table) { |
|
26
|
26
|
$this->_addRowModel($table); |
|
27
|
27
|
parent::_generateContent($table); |
|
28
|
28
|
} |
|
29
|
29
|
|
|
30
|
|
- protected function _addRowModel($table){ |
|
|
30
|
+ protected function _addRowModel($table) { |
|
31
|
31
|
$fields=$this->_instanceViewer->getSimpleProperties(); |
|
32
|
|
- $row=$this->_createRow($table, $this->_modelClass,$fields); |
|
33
|
|
- $row->setProperty("style","display:none;"); |
|
|
32
|
+ $row=$this->_createRow($table, $this->_modelClass, $fields); |
|
|
33
|
+ $row->setProperty("style", "display:none;"); |
|
34
|
34
|
$table->getBody()->_addRow($row); |
|
35
|
35
|
} |
|
36
|
36
|
|
|
37
|
|
- protected function _createRow($table,$rowClass,$fields){ |
|
|
37
|
+ protected function _createRow($table, $rowClass, $fields) { |
|
38
|
38
|
$object=JReflection::jsonObject($this->_model); |
|
39
|
|
- if(isset($this->_rowModelCallback)){ |
|
|
39
|
+ if (isset($this->_rowModelCallback)) { |
|
40
|
40
|
$callback=$this->_rowModelCallback; |
|
41
|
41
|
$callback($object); |
|
42
|
42
|
} |
|
43
|
|
- $row=$this->_generateRow($object, $fields,$table,"_jsonArrayChecked"); |
|
|
43
|
+ $row=$this->_generateRow($object, $fields, $table, "_jsonArrayChecked"); |
|
44
|
44
|
$row->setClass($rowClass." _element"); |
|
45
|
45
|
return $row; |
|
46
|
46
|
} |
|
@@ -49,23 +49,23 @@ discard block |
|
|
block discarded – undo |
|
49
|
49
|
* {@inheritDoc} |
|
50
|
50
|
* @see DataTable::_associatePaginationBehavior() |
|
51
|
51
|
*/ |
|
52
|
|
- protected function _associatePaginationBehavior(JsUtils $js=NULL,$offset=null){ |
|
|
52
|
+ protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) { |
|
53
|
53
|
$callback=null; |
|
54
|
54
|
$menu=$this->_pagination->getMenu(); |
|
55
|
55
|
|
|
56
|
|
- if(isset($js)){ |
|
|
56
|
+ if (isset($js)) { |
|
57
|
57
|
$id=$this->identifier; |
|
58
|
58
|
$callback=$js->getScript($offset).$this->getHtmlComponent()->getInnerScript(); |
|
59
|
|
- $callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
|
|
59
|
+ $callback.=$js->trigger("#".$id." [name='selection[]']", "change", false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
|
60
|
60
|
$callback.=$this->_generatePaginationScript($id); |
|
61
|
|
- if(isset($this->_urls["refresh"])){ |
|
62
|
|
- $js->jsonArrayOn("click", "#".$menu->getIdentifier()." a","#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]); |
|
|
61
|
+ if (isset($this->_urls["refresh"])) { |
|
|
62
|
+ $js->jsonArrayOn("click", "#".$menu->getIdentifier()." a", "#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"], "post", ["params"=>"{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "jsCallback"=>$callback]); |
|
63
|
63
|
} |
|
64
|
64
|
} |
|
65
|
65
|
|
|
66
|
66
|
} |
|
67
|
67
|
|
|
68
|
|
- protected function _generatePaginationScript($id){ |
|
|
68
|
+ protected function _generatePaginationScript($id) { |
|
69
|
69
|
return ";var page=parseInt($(self).attr('data-page')) || 1;var pages_visibles=$('#pagination-{$id} .item').length-2; |
|
70
|
70
|
var lastPage=$('#pagination-{$id} ._lastPage'); |
|
71
|
71
|
var middle= Math.ceil((pages_visibles-1)/ 2); |
|
@@ -85,16 +85,16 @@ discard block |
|
|
block discarded – undo |
|
85
|
85
|
lastPage.attr('data-page',Math.min(lastPage.attr('data-max'),page+1)); |
|
86
|
86
|
$('#{$id}').trigger('pageChange');$('#{$id}').trigger('activeRowChange');$('#pagination-{$id}').show();"; |
|
87
|
87
|
} |
|
88
|
|
- protected function _compileSearchFieldBehavior(JsUtils $js=NULL){ |
|
|
88
|
+ protected function _compileSearchFieldBehavior(JsUtils $js=NULL) { |
|
89
|
89
|
|
|
90
|
90
|
} |
|
91
|
|
- protected function _associateSearchFieldBehavior(JsUtils $js=NULL,$offset=null){ |
|
92
|
|
- if(isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])){ |
|
|
91
|
+ protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) { |
|
|
92
|
+ if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) { |
|
93
|
93
|
$id=$this->identifier; |
|
94
|
94
|
$callback=$js->getScript($offset).$this->getHtmlComponent()->getInnerScript(); |
|
95
|
|
- $callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
|
|
95
|
+ $callback.=$js->trigger("#".$id." [name='selection[]']", "change", false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js)); |
|
96
|
96
|
$callback.="$('#pagination-{$id}').hide();$('#".$this->identifier."').trigger('searchTerminate',[$(self).val()]);"; |
|
97
|
|
- $js->jsonArrayOn("change", "#".$this->_searchField->getDataField()->getIdentifier(),"#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]); |
|
|
97
|
+ $js->jsonArrayOn("change", "#".$this->_searchField->getDataField()->getIdentifier(), "#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"], "post", ["params"=>"{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "jsCallback"=>$callback]); |
|
98
|
98
|
} |
|
99
|
99
|
} |
|
100
|
100
|
|
|
@@ -108,29 +108,29 @@ discard block |
|
|
block discarded – undo |
|
108
|
108
|
* @param string $jsCallback |
|
109
|
109
|
* @return AjaxCall |
|
110
|
110
|
*/ |
|
111
|
|
- public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){ |
|
112
|
|
- $parameters=\array_merge($parameters,["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass,"url"=>$url,"method"=>$method,"params"=>$params,"jsCallback"=>$jsCallback]); |
|
|
111
|
+ public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) { |
|
|
112
|
+ $parameters=\array_merge($parameters, ["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass, "url"=>$url, "method"=>$method, "params"=>$params, "jsCallback"=>$jsCallback]); |
|
113
|
113
|
return new AjaxCall("jsonArray", $parameters); |
|
114
|
114
|
} |
|
115
|
115
|
|
|
116
|
|
- public function jsClear(){ |
|
|
116
|
+ public function jsClear() { |
|
117
|
117
|
return "$('#{$this->identifier} tbody').find('._json').remove();"; |
|
118
|
118
|
} |
|
119
|
119
|
|
|
120
|
|
- public function clearOn(BaseHtml $element,$event, $stopPropagation=false, $preventDefault=false){ |
|
121
|
|
- return $element->addEvent($event, $this->jsClear(),$stopPropagation,$preventDefault); |
|
|
120
|
+ public function clearOn(BaseHtml $element, $event, $stopPropagation=false, $preventDefault=false) { |
|
|
121
|
+ return $element->addEvent($event, $this->jsClear(), $stopPropagation, $preventDefault); |
|
122
|
122
|
} |
|
123
|
123
|
|
|
124
|
|
- public function clearOnClick(BaseHtml $element,$stopPropagation=false, $preventDefault=false){ |
|
125
|
|
- return $this->clearOn($element, "click",$stopPropagation,$preventDefault); |
|
|
124
|
+ public function clearOnClick(BaseHtml $element, $stopPropagation=false, $preventDefault=false) { |
|
|
125
|
+ return $this->clearOn($element, "click", $stopPropagation, $preventDefault); |
|
126
|
126
|
} |
|
127
|
127
|
|
|
128
|
|
- public function jsonArrayOn(BaseHtml $element,$event,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){ |
|
129
|
|
- return $element->_addEvent($event, $this->jsJsonArray($url,$method,$params,$jsCallback,$parameters)); |
|
|
128
|
+ public function jsonArrayOn(BaseHtml $element, $event, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) { |
|
|
129
|
+ return $element->_addEvent($event, $this->jsJsonArray($url, $method, $params, $jsCallback, $parameters)); |
|
130
|
130
|
} |
|
131
|
131
|
|
|
132
|
|
- public function jsonArrayOnClick(BaseHtml $element,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){ |
|
133
|
|
- return $this->jsonArrayOn($element, "click", $url,$method,$params,$jsCallback,$parameters); |
|
|
132
|
+ public function jsonArrayOnClick(BaseHtml $element, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) { |
|
|
133
|
+ return $this->jsonArrayOn($element, "click", $url, $method, $params, $jsCallback, $parameters); |
|
134
|
134
|
} |
|
135
|
135
|
|
|
136
|
136
|
/** |
|
@@ -141,8 +141,8 @@ discard block |
|
|
block discarded – undo |
|
141
|
141
|
* @param number $pages_visibles The number of visible pages in the Pagination component |
|
142
|
142
|
* @return DataTable |
|
143
|
143
|
*/ |
|
144
|
|
- public function paginate($page,$total_rowcount,$items_per_page=10,$pages_visibles=null){ |
|
145
|
|
- return parent::paginate($page, $total_rowcount,$items_per_page,$pages_visibles); |
|
|
144
|
+ public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) { |
|
|
145
|
+ return parent::paginate($page, $total_rowcount, $items_per_page, $pages_visibles); |
|
146
|
146
|
} |
|
147
|
147
|
|
|
148
|
148
|
public function setRowModelCallback($_rowModelCallback) { |