Answer the question
In order to leave comments, you need to log in
Yii 'visible'=> false?
I want to check this 'visible'=> '($data->type == 3)? true: false',
but it doesn't work
$myarray[] = array(
'class' => 'bootstrap.widgets.TbButtonColumn', //кнопка добавления данных
'template' => '{add}',
'visible'=> dep($data->type),
$myarray[] = array(
'class' => 'CButtonColumn', //кнопка
'template' => '{add}',
//'visible'=> $data->type == 3,
'buttons' => array(
'add' => array(//the name {reply} must be same
'label' => '+', // text label of the button
'url' => '$data->id."|".$data->name."|".$data->type',
'click' => 'function(){
data=$(this).attr("href").split("|")
if (data[2] == 3){
$("#myModalHeader").html(data[1]);
$("#myModalBody").load("' . $this->createUrl('analizCreate/modalcreate') . '/?id="+data[0]+"");
$("#myModal").modal();}
return false;
}',
////Your URL According to your wish
'options' => array(
'class' => 'btn btn-small btn-success' ,
),
),
),
Answer the question
In order to leave comments, you need to log in
'visible'=> '($data->type == 3)? true: false',
Why is the ternary operator enclosed in single brackets? What for?
Remove the ternary operator...'visible'=> $data->type == 3,
remove the quotes...
If it still doesn't work, then study with var_dump what $data->type produces
Try like this
$myarray[] = array(
'class' => 'CButtonColumn', //кнопка
'template' => '{add}',
'buttons' => array(
'add' => array(//the name {reply} must be same
'label' => '+', // text label of the button
'visible'=> '$data->type == 3',
'url' => '$data->id."|".$data->name."|".$data->type',
'click' => 'function(){
data=$(this).attr("href").split("|")
if (data[2] == 3){
$("#myModalHeader").html(data[1]);
$("#myModalBody").load("' . $this->createUrl('analizCreate/modalcreate') . '/?id="+data[0]+"");
$("#myModal").modal();}
return false;
}',
////Your URL According to your wish
'options' => array(
'class' => 'btn btn-small btn-success' ,
),
),
),
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question