@@ -58,7 +58,7 @@ class DataTable extends Widget {
58
58
protected $ _hiddenColumns ;
59
59
60
60
protected $ _colWidths ;
61
-
61
+
62
62
protected $ _paginationToolbar ;
63
63
64
64
public function __construct ($ identifier , $ model , $ modelInstance = NULL ) {
@@ -314,7 +314,7 @@ protected function _generatePagination($table) {
314
314
}
315
315
$ footer = $ table ->getFooter ();
316
316
$ footer ->mergeCol ();
317
- $ this ->_paginationToolbar = $ this ->_pagination ->generateMenu ($ this ->identifier );
317
+ $ this ->_paginationToolbar = $ this ->_pagination ->generateMenu ($ this ->identifier );
318
318
$ footer ->addValues ($ this ->_paginationToolbar );
319
319
}
320
320
@@ -360,22 +360,32 @@ protected function _getFieldCaption($index) {
360
360
return null ;
361
361
}
362
362
363
- protected function _setToolbarPosition ( $ table , $ captions = NULL ) {
364
- switch ($ this -> _toolbarPosition ) {
363
+ protected function applyToolbarPosition ( string $ position , $ table , $ captions = NULL ) {
364
+ switch ($ position ) {
365
365
case PositionInTable::BEFORETABLE :
366
366
case PositionInTable::AFTERTABLE :
367
367
if (isset ($ this ->_compileParts ) === false ) {
368
- $ this ->content [$ this -> _toolbarPosition ] = $ this ->_toolbar ;
368
+ $ this ->content [$ position ] = $ this ->_toolbar ;
369
369
}
370
370
break ;
371
371
case PositionInTable::HEADER :
372
372
case PositionInTable::FOOTER :
373
373
case PositionInTable::BODY :
374
- $ this ->addToolbarRow ($ this -> _toolbarPosition , $ table , $ captions );
374
+ $ this ->addToolbarRow ($ position , $ table , $ captions );
375
375
break ;
376
376
}
377
377
}
378
378
379
+ protected function _setToolbarPosition ($ table , $ captions = NULL ) {
380
+ if (\is_array ($ this ->_toolbarPosition )) {
381
+ foreach ($ this ->_toolbarPosition as $ tbp ) {
382
+ $ this ->applyToolbarPosition ($ tbp , $ table , $ captions );
383
+ }
384
+ } else {
385
+ $ this ->applyToolbarPosition ($ this ->_toolbarPosition , $ table , $ captions );
386
+ }
387
+ }
388
+
379
389
/**
380
390
* Associates a $callback function after the compilation of the field at $index position
381
391
* The $callback function can take the following arguments : $field=>the compiled field, $instance : the active instance of the object, $index: the field position
@@ -482,7 +492,9 @@ public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles =
482
492
* @param array $compileParts
483
493
* @return DataTable
484
494
*/
485
- public function refresh ($ compileParts = ['tbody ' ]) {
495
+ public function refresh ($ compileParts = [
496
+ 'tbody '
497
+ ]) {
486
498
$ this ->_compileParts = $ compileParts ;
487
499
return $ this ;
488
500
}
@@ -616,8 +628,8 @@ public function setActiveRowSelector($class = "active", $event = "click", $multi
616
628
$ this ->_self ->setActiveRowSelector ($ class , $ event , $ multiple );
617
629
return $ this ;
618
630
}
619
-
620
- public function hasActiveRowSelector (){
631
+
632
+ public function hasActiveRowSelector () {
621
633
return $ this ->_self ->hasActiveRowSelector ();
622
634
}
623
635
@@ -707,16 +719,18 @@ public function setGroupByFields($_groupByFields) {
707
719
public function setVisibleHover ($ _visibleHover ) {
708
720
$ this ->_visibleHover = $ _visibleHover ;
709
721
}
722
+
710
723
/**
724
+ *
711
725
* @return \Ajax\semantic\html\collections\menus\HtmlPaginationMenu
712
726
*/
713
727
public function getPaginationToolbar () {
714
728
return $ this ->_paginationToolbar ;
715
729
}
716
-
717
- public function setInverted ($ recursive= true ){
730
+
731
+ public function setInverted ($ recursive = true ) {
718
732
$ this ->getHtmlComponent ()->setInverted ($ recursive );
719
- if ($ this ->_emptyMessage instanceof HtmlSemDoubleElement){
733
+ if ($ this ->_emptyMessage instanceof HtmlSemDoubleElement) {
720
734
$ this ->_emptyMessage ->setInverted ($ recursive );
721
735
}
722
736
}
0 commit comments