如何在 Krajee GridView 中获取字段的值?

How to get a value of field in Krajee GridView?

如何在 Krajee GridView 中获取 ID 的值? 我想在 "onclick="get('.$ID.')".

中使用 id 值
GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        'id',
        [
            'class' => '\kartik\grid\ActionColumn',
            'updateOptions' =>['style' => 'display:none'],
            'width' => '60px',
            'template' => '<a href="#" onclick="get('.$ID.');" >a</a>',
        ]

我认为你应该使用与按钮名称相关的回调

        ['class' => '\kartik\grid\ActionColumn',
            'contentOptions' => ['style' => 'width:34px; font-size:22px;'],
            'template' => '{update}',               
            'buttons' => [
                'update' => function ($url, $model) {
                    return   '<a href="#" onclick="get('.$model->id.');" >a</a>';
                },
             ],
        ]