|
13 | 13 | use Ajax\semantic\html\collections\table\traits\TableTrait; |
14 | 14 | use Ajax\semantic\html\collections\HtmlMessage; |
15 | 15 | use Ajax\semantic\html\base\traits\BaseTrait; |
| 16 | +use Ubiquity\utils\base\UString; |
16 | 17 |
|
17 | 18 | /** |
18 | 19 | * DataTable widget for displaying list of objects |
@@ -63,13 +64,13 @@ public function run(JsUtils $js){ |
63 | 64 | if(\is_array($this->_editBehavior)) |
64 | 65 | $this->_generateBehavior("edit",$this->_editBehavior,$js); |
65 | 66 | if(\is_array($this->_displayBehavior)){ |
66 | | - $this->_displayBehavior["jsCallback"]='$("#dataTable").hide();'; |
67 | 67 | $this->_generateBehavior("display",$this->_displayBehavior,$js); |
68 | 68 | } |
69 | 69 | parent::run($js); |
70 | | - $this->_associateSearchFieldBehavior($js,$offset); |
71 | 70 | if(isset($this->_pagination)) |
72 | 71 | $this->_associatePaginationBehavior($js,$offset); |
| 72 | + $this->_associateSearchFieldBehavior($js,$offset); |
| 73 | + |
73 | 74 | } |
74 | 75 |
|
75 | 76 | protected function _generateBehavior($op,$params,JsUtils $js){ |
@@ -219,13 +220,13 @@ protected function _generatePagination($table){ |
219 | 220 |
|
220 | 221 | protected function _associatePaginationBehavior(JsUtils $js=NULL,$offset=null){ |
221 | 222 | if(isset($this->_urls["refresh"])){ |
222 | | - $this->_pagination->getMenu()->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>false,"jsCallback"=>'$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");']); |
| 223 | + $this->_pagination->getMenu()->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page'),'_model':'".UString::doubleBackSlashes($this->_model)."'}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>false,"jsCallback"=>'$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");']); |
223 | 224 | } |
224 | 225 | } |
225 | 226 |
|
226 | 227 | protected function _compileSearchFieldBehavior(JsUtils $js=NULL){ |
227 | 228 | if(isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])){ |
228 | | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(self).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>"internal","jsCallback"=>'$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);']); |
| 229 | + $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(self).val(),'_model':'".UString::doubleBackSlashes($this->_model)."'}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>"internal","jsCallback"=>'$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);']); |
229 | 230 | } |
230 | 231 | } |
231 | 232 | protected function _associateSearchFieldBehavior(JsUtils $js=NULL,$offset=null){ |
@@ -498,4 +499,32 @@ public function onActiveRowChange($jsCode){ |
498 | 499 | $this->getHtmlComponent()->onActiveRowChange($jsCode); |
499 | 500 | return $this; |
500 | 501 | } |
| 502 | + /** |
| 503 | + * @return mixed |
| 504 | + */ |
| 505 | + public function getDeleteBehavior() { |
| 506 | + return $this->_deleteBehavior; |
| 507 | + } |
| 508 | + |
| 509 | + /** |
| 510 | + * @return mixed |
| 511 | + */ |
| 512 | + public function getEditBehavior() { |
| 513 | + return $this->_editBehavior; |
| 514 | + } |
| 515 | + |
| 516 | + /** |
| 517 | + * @return mixed |
| 518 | + */ |
| 519 | + public function getDisplayBehavior() { |
| 520 | + return $this->_displayBehavior; |
| 521 | + } |
| 522 | + /** |
| 523 | + * @param mixed $_displayBehavior |
| 524 | + */ |
| 525 | + public function setDisplayBehavior($_displayBehavior) { |
| 526 | + $this->_displayBehavior = $_displayBehavior; |
| 527 | + } |
| 528 | + |
| 529 | + |
501 | 530 | } |
0 commit comments