Dear everyone,
I’m trying to set up CButtonColumn with the following requirement.
Let says there is a $data like
[0] => array (
'submit_date' => '10.01.2011'
),
[1] => array (
'submit_date' => ''
),
I want to create a CGridView and use CButtonColumn for
-
display a button if ‘submit_date’ is empty.
-
display a text of date if ‘submit_date’ is not empty.
Here is what I’ve tried to do. I create 2 buttons, one for display a button if ‘submit_date’ is empty and another one for ‘submit_date’ is not empty and that the button which I don’t know how to display its as text and without link to anywhere.
Here is a part of my code
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'data-grid',
'dataProvider'=>$model->getData(),
'columns'=>array(
array(
'class'=>'CButtonColumn',
'header'=>'Operations',
'template' => '{date}{submit}',
'buttons' => array(
'date' => array(
'lable' => 'date("F j, Y",strtotime($data[submit_date]))',
'imageUrl' => '',
'visible'=>'$data[submit_date]!=""',
),
'submit' => array(
'imageUrl'=>Yii::app()->request->baseUrl.'/images/submit.png',
'visible'=>'$data[submit_date]==""',
),
),
),
),
));
It failed to display text instead of button name and the href link still here.
So is it possible to do it? and how?
Thanks in advance.