CGridViewで使用したコードでは、$data->gen_idと$data->erc_genの列の値にnull値が表示されますが、ブラウザーインスペクターで検査すると、この値が表示されます。<a href="/ekportal/erc/index.php?r=ercGen/update&id="></a>
以下のercgen/adminコード:
$qryTmp =
"SELECT gen_id, erc_ref,B.complete_name sales_executive,C.description type,D.client_name client_id,event_name, E.status_desc erc_status ".
"FROM erc_gen A, Users B, erc_type C, clients D, erc_status E ".
"WHERE A.sales_executive = b.user_id ".
"AND A.type = C.typ_no ".
"AND A.client_id = D.client_id ".
"AND A.erc_status = E.id ".
"AND sales_executive = '$user_id' ".
"AND erc_status = '1' ";
$count = Yii::app()->db->createCommand('SELECT COUNT(*) FROM ('.$qryTmp.') X')->queryScalar();
$dataProvider=new CSqlDataProvider($qryTmp, array(
'totalItemCount'=>$count,
'sort'=>array(
'attributes'=>array(
'gen_id','erc_ref', 'sales_executive', 'type','client_id','event_name','erc_status'
),
),
'pagination'=>array(
'pageSize'=>10,
),
));
//CGRIDVIEW
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'pager'=>array(
'header'=>'',
'firstPageLabel'=>'<<',
'prevPageLabel'=>'<',
'nextPageLabel'=>'>',
'lastPageLabel'=>'>>',
),
'columns'=>array(
array(
'header'=>'#',
'value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
),
array(
'header'=>'Reference Number',
'name'=>'erc_ref',
'type'=>'raw',
'value'=>'CHtml::link($data->erc_ref,Yii::app()->createUrl("ercGen/update",array("id"=>"$data->gen_id")))',
),