kartik-v / yii2-dynagrid

Turbo charge the Yii 2 GridView with personalized columns, page size, and themes.
http://demos.krajee.com/dynagrid
Other
74 stars 66 forks source link

Class 'kartik\widgets\DynaGrid' not found #8

Closed monghuz closed 10 years ago

monghuz commented 10 years ago

I followed the configuration steps (details later), but I get this error message.

After a successfully composer update I see yii2-dynagrid folder inside kartik-v folder. If I am right there should be a DynaGrid.php file inside kartik-v/widgets folder, but there isn't.

Maybe I forget to config something, but I lost in debuging :(

My config steps were the followings: I inserted the following into web.php module section.

'dynagrid'=> [
        'class'=>'\kartik\dynagrid\Module',
        'class'=>'yii\i18n\PhpMessageSource',
        'basePath'=>'@kvdynagrid/messages',
        'forceTranslation'=>true
    ],
    'gridview'=> [
        'class'=>'\kartik\grid\Module',
        'class'=>'yii\i18n\PhpMessageSource',
        'basePath'=>'@kvdynagrid/messages',
        'forceTranslation'=>true
    ],

In my index.php I added these namespaces

use yii\helpers\ArrayHelper;
use kartik\helpers\Html;
use kartik\grid\GridView;
use kartik\widgets\DynaGrid;

After the $gridColums configuration I called the widget. Not that I get the error message for the first line of the following code.

<?= DynaGrid::widget([
        'columns' => $gridColumns,
        'storage'=>DynaGrid::TYPE_COOKIE,
        'theme'=>'panel-danger',
        'gridOptions'=>[
            'dataProvider'=>$dataProvider,
            'filterModel'=>$searchModel,
            'gridOptions'=>[
                'dataProvider'=>$dataProvider,
                'filterModel'=>$searchModel,
                'panel'=>['heading'=>'<h3 class="panel-title">Library</h3>'],
            ]
        ]
    ]); ?>
kartik-v commented 10 years ago

you are using the wrong namespace for dynagrid... instead of wrongly typing kartik\widgets\DynaGrid; change to following

use kartik\dynagrid\DynaGrid;