From 882d2302c6e246c976395269715c730c3f79960c Mon Sep 17 00:00:00 2001 From: "hello.omny" Date: Mon, 23 Jan 2017 17:00:46 +0300 Subject: [PATCH] Added option for wrapping content table. --- GridView.php | 13 ++++++++++++- README.md | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/GridView.php b/GridView.php index 1667146..b348641 100644 --- a/GridView.php +++ b/GridView.php @@ -24,6 +24,11 @@ class GridView extends \yii\grid\GridView public $paginationPageSize = [20,50,100,300]; + /** + * @var null|string + */ + public $tableWrapperClass = null; + public $menuColumns = true; //public $resizeColumn = true; @@ -286,7 +291,13 @@ public function renderItems() $tableFooter ]); - return Html::tag('table', implode("\n", $content), $this->tableOptions); + $contentTable = Html::tag('table', implode("\n", $content), $this->tableOptions); + + if (!is_null($this->tableWrapperClass)) { + $contentTable = Html::tag('div', $contentTable, ['class' => $this->tableWrapperClass]); + } + + return $contentTable; } /** diff --git a/README.md b/README.md index 5cb1da0..4e40d9f 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Once the extension is installed, simply use it in your code by : 'paginationPageSize' => [20,50,100], // is empty array hide control 'menuControl' => true, // Show menu control 'menuColumnsBtnLabel' => 'Show / hide columns', + 'tableWrapperClass' => 'table table-responsive', // Wrapper class for table, if not defined not rendered. 'showFooter' => true, 'toolbar' => [ 'default' => ''