Grid and block view manage
Grid and block view manage in Yii2 GridView
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist salamandra-systems/yii2-grid "*"
or add
"salamandra-systems/yii2-grid": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
use Yii;
use salamandra\grid\GridView;
<?=GridView::widget([
'id'=>'product-grid',
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'actions'=>[
'items'=>[
[
'title'=>'Edit',
'icon'=>'fa fa-pencil',
'items'=>[
[
'name'=>'Change Price',
'url'=>Yii::$app->urlManager->createUrl(['products/change-price']),
],
[
'name'=>'Set Discount',
'url'=>Yii::$app->urlManager->createUrl(['products/set-discount'])
]
]
],
[
'title'=>'Clone',
'url'=>Yii::$app->urlManager->createUrl(['products/clone']),
'icon'=>'fa fa-clone'
]
]
],
'columns' => [
[
'class' => 'yii\grid\CheckboxColumn',
],
'sku',
'title',
'price',
[
'class' => 'yii\grid\ActionColumn',
],
],
])?>