kak / grid
GridView, TreeGrid widgets for Yii2
Installs: 1 941
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- bower-asset/store.js: ~2.0
- box/spout: 2.7.3
- yiisoft/yii2: *
README
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist kak/grid "*"
Usage
Once the extension is installed, simply use it in your code by :
<?php use kak\widgets\grid\GridView; use yii\helpers\Html; echo GridView::widget([ 'showFooter' => true, 'dataProvider' => $provider, 'columns' => [ 'user' => [ 'header' => 'user', 'format' => 'html', 'value' => function($data){ return '[' . $data->stream_id . '] ' . Html::a($data->user->name,['user/update', 'id' => $data->user->id ]); } ], 'date_key', 'os', 'browser', 'operator_id' => [ 'header' => 'Operator', 'value' => 'operator.name' ], 'country_id' => [ 'header' => 'Country', 'format' => 'html', 'value' => function($data){ return Html::img($data->country->flag_url,['title' => $data->country->name_ru]); }, 'footer' => '<b>Total redirect</b>', ], 'view_count' => [ 'attribute' => 'view_count', 'summary' => 'sum' ], 'redirect_count' => [ 'attribute' => 'redirect_count', 'summary' => 'sum' ], 'ratio (redirect/view)' => [ 'header' => 'Ratio', 'value' => function($data){ return round( (int)$data->redirect_count/(int)$data->view_count ,2); } ], 'actions' => [ 'class' => \yii\grid\ActionColumn::className(), 'template' => '{view}', ], ] ])?>
Column types
- DataColumn ( support editable in processing)
- LabelColumn
- SwapColumn ( in processing )
Behaviors
- ToolBarBehavior (base attach old beg panel plugins)
- ExportTableBehavior (export popular format json, csv, excel)
- MenuColumnsBehavior ( in processing )
- PageSizeBehavior
- AutoFilterBehavior ( in processing )
- ResizableColumnsBehavior