Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TbToggleColumn $data->primaryKey is not working #1042

Open
Jay0Wei opened this issue Nov 30, 2016 · 0 comments
Open

TbToggleColumn $data->primaryKey is not working #1042

Jay0Wei opened this issue Nov 30, 2016 · 0 comments

Comments

@Jay0Wei
Copy link

Jay0Wei commented Nov 30, 2016

$data->primaryKey is null when constructing the ajax request url,

when change to $data["id"],it works!

In CSqlDataProvider i have set the "keyField" to "id", is it a bug that you always use $data->primaryKey to create the url, in fact $data does have a field call "primaryKey", how can you get the value of it? -- it's just an array of assicative array, which does not have any information about which attribute is the primarykey!

you should have a attribute for us to specify the id attribute name - $idAttr ,
and use it in initButton method like this :
$this->button = array( 'url' => 'Yii::app()->controller->createUrl("' . $this->toggleAction . '",array("pk"=>$data[' . $this->idAttr . '],"attribute"=>"' . $this->name . '"))', 'htmlOptions' => array('class' => $this->name . '_toggle' . $this->uniqueClassSuffix), );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant