YiiBooster
YiiBooster copied to clipboard
TbToggleColumn $data->primaryKey is not working
$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), );