grid view buttons

I want to use gridview with update and delete buttons for the model.How can I implement it,is there any tutorial?

[edit]I found but how can I set the right ids at querystring (to delete etc,


for example)?

Just add the ActionColumn, it’ll use the row’s primary key automatically.

So at controller I write

$dataProvider = new \yii\data\SqlDataProvider([

    'sql' => 'select id,surname,code,date,active from orders order by date desc'  



and at view

<?=  yii\grid\GridView::widget([

    'dataProvider' => $dataProvider,

    'columns' => [




            'attribute' => 'date',

            'format' => ['date', 'php:Y-m-d']



            'class' => 'yii\grid\ActionColumn',

            // you may configure additional properties here



]); ?>

and it does not seem to take the primary key,it begins from 0


and goes on 1,2,3,4 and 18 at last record (with id 19).

What is going wrong?

You have to set the key in your data provider:$key-detail