doujun1495
2018-06-07 18:52
浏览 122
已采纳

Yii2 GridView CheckboxColumn

I have a working Yii2 application locally with GridView but immediately I deployed it online, I started having issues with it. Below is the error and the code for the GridView:

ReflectionException Class \kartik\grid\checkBoxColumn does not exist

View File

use kartik\grid\GridView;

<?= GridView::widget([
                        'dataProvider' => $dataProvider,
                        'filterModel' => $searchModel,
                        'options' => [
                            'class' => 'table table-responsive'
                        ],
                        'columns' => [
                            ['class' => 'kartik\grid\checkBoxColumn'],

                            [
                                'class' => 'kartik\grid\ActionColumn',
                                'header' => 'Actions',
                                'headerOptions' => ['width' => '40'],
                                'template' => '{view}&ensp;{update}'
                            ],
                        ],
                    ]); ?>

I have tried to upgrade the version of the Yii2 application but yet I am still getting the same issue meanwhile everything is working fine locally.

图片转代码服务由CSDN问答提供 功能建议

我在本地使用 GridView 工作的Yii2应用程序但是我立即在线部署了它,我 开始遇到问题。 下面是 GridView 的错误和代码:

ReflectionException Class \ kartik \ grid \ checkBoxColumn 不存在

查看文件

 使用 kartik \ grid \ GridView; 
 
&lt;?= GridView :: widget([
'dataProvider'=&gt; $ dataProvider,
'filterModel'=&gt; $ searchModel,
'options'=&gt; [  
'class'=&gt;'table table-responsive'
],
'columns'=&gt; [
 ['class'=&gt;'kartik \ grid \ checkBoxColumn'],
 
 [  
'class'=&gt;'kartik \ grid \ ActionColumn',
'header'=&gt;'动作',
'headerOptions'=&gt; ['width'=&gt; '40'],
  'template'=&gt;'{view}&amp; ensp  ; {update}'
],
 
,
 
]);  ?&gt; 
   
 
 

我试图升级Yii2应用程序的版本但是我仍然遇到同样的问题,同时一切都在本地工作正常。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongshenyu4638 2018-06-07 19:03
    已采纳

    it should be '\kartik\grid\CheckboxColumn' rather than '\kartik\grid\checkboxColumn' you must be working on windows locally the file names are case sensitive on unix.

    change the below inside GridView

    'columns' => [
        ['class' => 'kartik\grid\checkBoxColumn'],
    

    to the following

    'columns' => [
        ['class' => 'kartik\grid\CheckBoxColumn'],
    
    点赞 打赏 评论

相关推荐 更多相似问题