2amigos / yii2-grid-view-library

Highly enhanced GridView widget and grid components for Yii2
https://2amigos.us
Other
57 stars 16 forks source link

Class GroupColumnsBehavior does not exist #31

Closed miladhashemi closed 7 years ago

miladhashemi commented 7 years ago

Hi 2amigos when in behaviors i use GroupColumnsBehavior as class it shows me: ReflectionException

Class GroupColumnsBehavior does not exist

tonydspaniard commented 7 years ago

Can you show your code? Thanks

miladhashemi commented 7 years ago

use dosamigos\grid\GridView; use dosamigos\grid\behaviors\GroupColumnsBehavior;

<?= GridView::widget([ 'behaviors' => [ [ 'class' => 'GroupColumnsBehavior', // 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'] ] ], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], 'group_name', 'description', 'category', ['class' => 'yii\grid\ActionColumn'], ], ]); ?>

tonydspaniard commented 7 years ago

You forgot to add the namespace to the class

miladhashemi commented 7 years ago

i'm new to Yii. the grid view is in view. is it necessary to use namespace? I add namespace but the result is same.

miladhashemi commented 7 years ago

viewfile

error

tonydspaniard commented 7 years ago

@miladhashemi you forgot to add the namespace of the class:

<?= GridView::widget([ 'behaviors' => [ [ 'class' => 'dosamigos\grid\behaviors\GroupColumnsBehavior' // <-------- here

If you don't want to do that... then do 'class' => GroupColumnsBehavior::class

harrisonalwanga commented 5 years ago

I found the same error the above did not solve my problem any other solution?