Closed miladhashemi closed 7 years ago
You develop gridview widget nicely. but DOC isn't clear enough.That's better, if you have more example in DOC. Thank You.
@miladhashemi you need to know how the Yii2 Gridview works. I highly recommend you to have a look at http://www.yiiframework.com/doc-2.0/yii-grid-actioncolumn.html
I used 'class' => ActionColumn::className(),
in gridview columns
But it show me this error:
Unknown Property – yii\base\UnknownPropertyException Getting unknown property: yii\grid\ActionColumn::attribute
@miladhashemi you obviously have missconfiguration of your grid. Do you mind pasting your code so i can see what you doing wrong?
@tonydspaniard Thank You so much.
<?php
use yii\helpers\Html;
use yii\grid\ActionColumn;
use dosamigos\grid\GridView;
use dosamigos\grid\behaviors\GroupColumnsBehavior;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\advance\models\TargetGroupSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'گروه های هدف';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="target-group-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?=
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'behaviors' => [
[
'class' => GroupColumnsBehavior::class,
// You an use multiple columns for extra row but remember that will affect the merging
// as both columns must be having same values for the extra row to title the records
'extraRowColumns' => ['category'],
// you can use multiple columns here
'mergeColumns' => ['category']
]
],
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'category',
'group_name',
'description',
['class' => ActionColumn::class]
],
]);
?>
</div>
@miladhashemi
Apologies, as your code is good. The only thing is that the GroupColumnsBehavior do not work with the ActionColumn
.
I will create a new ticket to make this behavior working with ActionColumn. Sorry again.
@tonydspaniard
Thank You indeed brother.
It has same problem with SerialColumn
too. I mean same Error.
How can i have action column in grid view? I use Your GridView+GroupColumnsBehavior Thanks