@@ -58,7 +58,7 @@ class DataTable extends Widget {
5858 protected $ _hiddenColumns ;
5959
6060 protected $ _colWidths ;
61-
61+
6262 protected $ _paginationToolbar ;
6363
6464 public function __construct ($ identifier , $ model , $ modelInstance = NULL ) {
@@ -314,7 +314,7 @@ protected function _generatePagination($table) {
314314 }
315315 $ footer = $ table ->getFooter ();
316316 $ footer ->mergeCol ();
317- $ this ->_paginationToolbar = $ this ->_pagination ->generateMenu ($ this ->identifier );
317+ $ this ->_paginationToolbar = $ this ->_pagination ->generateMenu ($ this ->identifier );
318318 $ footer ->addValues ($ this ->_paginationToolbar );
319319 }
320320
@@ -360,22 +360,32 @@ protected function _getFieldCaption($index) {
360360 return null ;
361361 }
362362
363- protected function _setToolbarPosition ( $ table , $ captions = NULL ) {
364- switch ($ this -> _toolbarPosition ) {
363+ protected function applyToolbarPosition ( string $ position , $ table , $ captions = NULL ) {
364+ switch ($ position ) {
365365 case PositionInTable::BEFORETABLE :
366366 case PositionInTable::AFTERTABLE :
367367 if (isset ($ this ->_compileParts ) === false ) {
368- $ this ->content [$ this -> _toolbarPosition ] = $ this ->_toolbar ;
368+ $ this ->content [$ position ] = $ this ->_toolbar ;
369369 }
370370 break ;
371371 case PositionInTable::HEADER :
372372 case PositionInTable::FOOTER :
373373 case PositionInTable::BODY :
374- $ this ->addToolbarRow ($ this -> _toolbarPosition , $ table , $ captions );
374+ $ this ->addToolbarRow ($ position , $ table , $ captions );
375375 break ;
376376 }
377377 }
378378
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+
379389 /**
380390 * Associates a $callback function after the compilation of the field at $index position
381391 * 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 =
482492 * @param array $compileParts
483493 * @return DataTable
484494 */
485- public function refresh ($ compileParts = ['tbody ' ]) {
495+ public function refresh ($ compileParts = [
496+ 'tbody '
497+ ]) {
486498 $ this ->_compileParts = $ compileParts ;
487499 return $ this ;
488500 }
@@ -616,8 +628,8 @@ public function setActiveRowSelector($class = "active", $event = "click", $multi
616628 $ this ->_self ->setActiveRowSelector ($ class , $ event , $ multiple );
617629 return $ this ;
618630 }
619-
620- public function hasActiveRowSelector (){
631+
632+ public function hasActiveRowSelector () {
621633 return $ this ->_self ->hasActiveRowSelector ();
622634 }
623635
@@ -707,16 +719,18 @@ public function setGroupByFields($_groupByFields) {
707719 public function setVisibleHover ($ _visibleHover ) {
708720 $ this ->_visibleHover = $ _visibleHover ;
709721 }
722+
710723 /**
724+ *
711725 * @return \Ajax\semantic\html\collections\menus\HtmlPaginationMenu
712726 */
713727 public function getPaginationToolbar () {
714728 return $ this ->_paginationToolbar ;
715729 }
716-
717- public function setInverted ($ recursive= true ){
730+
731+ public function setInverted ($ recursive = true ) {
718732 $ this ->getHtmlComponent ()->setInverted ($ recursive );
719- if ($ this ->_emptyMessage instanceof HtmlSemDoubleElement){
733+ if ($ this ->_emptyMessage instanceof HtmlSemDoubleElement) {
720734 $ this ->_emptyMessage ->setInverted ($ recursive );
721735 }
722736 }
0 commit comments