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

yii2 treeGrid widget 中ActionColumn的问题

WBOY
Release: 2016-06-06 20:17:00
Original
1519 people have browsed it

用了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>
Copy after login
Copy after login

回复内容:

用了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>
Copy after login
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template