So here is my question, below is CGridView, what I am trying to do is pass the phase_id from the grid to the EditableColumn source: which is using CHtml::listData(COSTCODES::model()->findAllByAttributes(array("phase_id"=>1)),"id", "description")
Note when I use array("phase_id"=>1) a number for the id it works I just need to be able to pass the value from phase_id from the grid column…
!Stumped!
$table_data = RatesPhase::model()->findByRatenamesPk($model->id);
//$model2 = COSTCODES::model()->findAllByAttributes(array('phase_id'=>$table_data[0]['phases_id']));
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'rates-phase-grid',
'htmlOptions' => array('class' => 'table table-striped table-bordered table-hover'),
'dataProvider'=>$table_data,
/*'filter'=>$model,*/
'columns'=>array(
array(
'class'=>'CButtonColumn',
'viewButtonUrl'=>'Yii::app()->createUrl("/RatesPhase/view/", array("id"=>$data["rates_id"]))'
,
'updateButtonUrl'=>'Yii::app()->createUrl("/RatesPhase/update/", array("id"=>$data["rates_id"]))'
,
'deleteButtonUrl'=>'Yii::app()->createUrl("/RatesPhase/delete/", array("id"=>$data["rates_id"]))'
),
'phases_id',
array(
'class' => 'editable.EditableColumn',
'name' => 'cost_code_id',
'headerHtmlOptions' => array('style' => 'width: 100px'),
'editable' => array(
'type' => 'checklist',
'model' =>$table_data,
'url' => $this->createUrl('costCodesRequiredJoin/create'),
'placement' => 'right',
'source' => CHtml::listData(COSTCODES::model()->findAllByAttributes(array("phase_id"=>1)),"id", "description"),
'onSave' => 'js: function(e, params) {
alert("Saved value: " + params.newValue); console.log(params);
}')
),
),
));