Home >Backend Development >PHP Tutorial >yii2 treeGrid widget 中ActionColumn的问题

yii2 treeGrid widget 中ActionColumn的问题

WBOY
WBOYOriginal
2016-06-06 20:17:001510browse

用了yii2的TreeGrid插件
yii2 treeGrid widget 中ActionColumn的问题
如图中所示,按钮的ID和该列对应不上

<code>view代码

 = TreeGrid::widget([
        'dataProvider' => $dataProvider,
        'keyColumnName' => 'id',
        'parentColumnName' => 'parent_id',
        'parentRootValue' => '0', //first parentId value

        'columns' => [
            'areaname',
            'id',
//            'parent_id',
            ['class' => 'yii\grid\ActionColumn',

            ]
        ]
    ]); ?>
    
    
    控制器代码
    
    
        public function actionIndex()
{
    $areaObject = new CpArea();
    $areaQuery = $areaObject::find()->orderBy('id');

    $dataProvider = new ActiveDataProvider([
        'query' => $areaQuery,
    ]);

    return $this->render('index', [
        'dataProvider' => $dataProvider
    ]);

}

我想问下 怎么做可以让后面的三个按钮和该列的id对应上</code>

回复内容:

用了yii2的TreeGrid插件
yii2 treeGrid widget 中ActionColumn的问题
如图中所示,按钮的ID和该列对应不上

<code>view代码

 = TreeGrid::widget([
        'dataProvider' => $dataProvider,
        'keyColumnName' => 'id',
        'parentColumnName' => 'parent_id',
        'parentRootValue' => '0', //first parentId value

        'columns' => [
            'areaname',
            'id',
//            'parent_id',
            ['class' => 'yii\grid\ActionColumn',

            ]
        ]
    ]); ?>
    
    
    控制器代码
    
    
        public function actionIndex()
{
    $areaObject = new CpArea();
    $areaQuery = $areaObject::find()->orderBy('id');

    $dataProvider = new ActiveDataProvider([
        'query' => $areaQuery,
    ]);

    return $this->render('index', [
        'dataProvider' => $dataProvider
    ]);

}

我想问下 怎么做可以让后面的三个按钮和该列的id对应上</code>

您好,有QQ吗,请联系,有点技术的问题希望和您交流下,我的QQ是97521142

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn