I am using an SqlDataProvider with a Yii GridView.
Everything displays correctly, however each of the buttons in ActionColumn have an ID of 0 (zero).
Does anybody know why this is and how to fix it?
I am using an SqlDataProvider with a Yii GridView.
Everything displays correctly, however each of the buttons in ActionColumn have an ID of 0 (zero).
Does anybody know why this is and how to fix it?
Ok, this was easy. It’s necessary to specify the ‘key’ property in the dataprovider:
$provider = new SqlDataProvider([
'sql' => $sql,
'params' => [':status' => 1],
'totalCount' => $count,
'key' => 'id',
'pagination' => [
'pageSize' => 50,
],
'sort' => [
'attributes' => [
'id',
'message_title',
'date_added',
],
],
]);
http://www.yiiframework.com/doc-2.0/yii-data-activedataprovider.html#%24key-detail