How to set key value in CGrideView when grid is po

2019-07-26 18:10发布

In Yii CGridView, when we select any row from grid by using:

'selectionChanged' => "function(id){ $.fn.yiiGridView.getSelection(id) }",

it gives proper key value of the record (when the grid is populated by table)


But, when I populate Grid with data of 3 tables as a View. The key value returns undefined.

I have id as field, and I want it as key value in that particular view. So, I can get Id of particular row to proceed further.

p.s.:
All the 3 tables have their own Primary Key.

1条回答
SAY GOODBYE
2楼-- · 2019-07-26 18:41

Have you looked into these options?

KeyAttribute (CActiveDataProvider)

KeyField (CArrayDataProvider)

They are what is used to generate that id in a gridview

查看更多
登录 后发表回答