@@ -58,7 +58,7 @@ class DataTable extends Widget {
5858protected $ _hiddenColumns ;
5959
6060protected $ _colWidths ;
61-
61+
6262protected $ _paginationToolbar ;
6363
6464public 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) {
360360return 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 ) {
365365case PositionInTable::BEFORETABLE :
366366case PositionInTable::AFTERTABLE :
367367if (isset ($ this ->_compileParts ) === false ) {
368- $ this ->content [$ this -> _toolbarPosition ] = $ this ->_toolbar ;
368+ $ this ->content [$ position ] = $ this ->_toolbar ;
369369}
370370break ;
371371case PositionInTable::HEADER :
372372case PositionInTable::FOOTER :
373373case PositionInTable::BODY :
374- $ this ->addToolbarRow ($ this -> _toolbarPosition , $ table , $ captions );
374+ $ this ->addToolbarRow ($ position , $ table , $ captions );
375375break ;
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 ;
487499return $ this ;
488500}
@@ -616,8 +628,8 @@ public function setActiveRowSelector($class = "active", $event = "click", $multi
616628$ this ->_self ->setActiveRowSelector ($ class , $ event , $ multiple );
617629return $ this ;
618630}
619-
620- public function hasActiveRowSelector (){
631+
632+ public function hasActiveRowSelector () {
621633return $ this ->_self ->hasActiveRowSelector ();
622634}
623635
@@ -707,16 +719,18 @@ public function setGroupByFields($_groupByFields) {
707719public function setVisibleHover ($ _visibleHover ) {
708720$ this ->_visibleHover = $ _visibleHover ;
709721}
722+
710723/**
724+ *
711725 * @return \Ajax\semantic\html\collections\menus\HtmlPaginationMenu
712726 */
713727public function getPaginationToolbar () {
714728return $ 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