Hello , it’s me again… ^^
still got trouble, I have another problem. I don’t know how to select the id of the selected row of a table. Does anybody know how to do it?
i have tables
functional_domain
pk->FUNCTIONAL_DOMAIN_ID
is_owned_by
pk->IS_OWNED_BY_ID (auto_incrément)
unique key->(FUNCTIONAL_DOMAIN_ID, BA_ID)
business_analyst
pk->BA_ID
I have a CGridView in my functional_domain/views showing the table used to show the list of the link between the rows of two table
functional_domain<----is_owned_by---->business_analyst
this CGridView shows the business_analyst.BA_ID with
functional_domain.FUNCTIONAL_DOMAIN_ID = is_owned_by.FUNCTIONAL_DOMAIN_ID
business_analyst.BA_ID = is_owned_by.BA_ID
and it works perfectly
but, i would like to add a column in my CGridView, the CButtonColumn buttons , with only {view} and {delete}
here is what i did
functional_domain/view
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'child-grid',
'dataProvider'=>$business_analystRecords,
'columns'=>array(
'BA_ID',
'BA_NAME',
array(
'class'=>'CButtonColumn',
'template'=>'{view} {delete}',
'deleteButtonUrl'=>'',
'viewButtonUrl'=>'Yii::app()->controller->createUrl("isOwnedBy/view",array("id"=>"'.isOwnedBy::model()->findBySql( 'select IS_OWNED_BY_ID FROM is_owned_by where FUNCTIONAL_DOMAIN_ID="'.$model->FUNCTIONAL_DOMAIN_ID.'" AND BA_ID=<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />?<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />')->IS_OWNED_BY_ID.'" ))',
),
),
));
functional_domain/controller
public function actionView($id)
{
$first_parent_instance = businessAnalyst::model()->find();
$is_owned_byRecords= isOwnedBy::model()->find();
$this->render('view',array(
'model'=>$this->loadModel($id),
'business_analystRecords'=>$this->getBusinessAnalystRecords($id),
'first_parent_instance'=>$first_parent_instance,
'is_owned_byRecords'=>$is_owned_byRecords,
));
}