Q:カスタムボタンを使用してカスタム列を作成するにはどうすればよいですか?
次のようにcgridviewでグリッドビューを作成したいと思います。どのようにできるのか?
会社名| ヘッダー1.1| ヘッダー1.2| ヘッダー2.1| ヘッダー2.2| ヘッダー3.1| ヘッダー3.2
AAAA1 | [ボタン]| [ボタン]| [ボタン]| [ボタン]| [ボタン]| [ボタン]
BBBB1 | [ボタン]| [ボタン]| [ボタン]| [ボタン]| [ボタン]| [ボタン]
CCCC1 | [ボタン]| [ボタン]| [ボタン]| [ボタン]| [ボタン]| [ボタン]
================================================== ================================更新
これは私のcgridviewコードです
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'customer-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'customer_name',
array(
'class'=>'CButtonColumn',
'template'=>'{select1} {select2} {select3} {select4} {select5} {select6} {select7} {select8}',
'buttons'=>array
(
'select1' => array
(
'label'=>'Send an e-mail to this user',
'url'=>'Yii::app()->createUrl("job/getjobno", array("c_code"=>$data->c_code))',
'imageUrl'=>Yii::app()->request->baseUrl.'/protected/assets/images/gridview/icon_select.gif',
'options'=>array('style'=>'width:10px; border:none'),
'click'=>'function(event) {
$.ajax({
url:$(this).attr("href"),
dataType: \'json\',
success: function(data){
//alert(data.newjobno);
$("#Job_name").val(data.newjobno);
//console.log(\'target tr: \' + target);
//$(target).find(\'.item-price\').val(data.newjobno);
$("#customerlist").dialog("close");
}
});
event.preventDefault();
}',
),
),
),
array(
'type'=>'raw',
'value'=>'$data->c_code',
//'filter'=>array('style'=>'visible:none'),
'headerHtmlOptions'=>array('style'=>'width:0px; display:none; border:none; textdecoration:none'),
'htmlOptions'=>array('style'=>'display:none; border:none;', 'class'=>'customer-id'),
'header'=>false,
'filter'=>false,
),
),
)); ?>