How To Hide Attribute In Bootstrap.widgets.tbdetailview


(Javi Hunzai) #1

Hi all,

Can any one tell me that how to apply htmloption on bootstrap.widgets.TbDetailView attribute. I want to hide an attribute on runtime (by apply some condition). Following is my View.php code:




$this->widget('bootstrap.widgets.TbDetailView', array(

    'data' => $model,

    'type' => 'striped bordered condensed',

    'attributes' => array(

// I want to show bonus attribute if and only if its value is greater than 0

array('name'=>'bonus', 'value'=> $model->bonus, 'htmlOptions'=>array("style"=>"display:none;")),

),

));




(Juniorpiresupe) #2

You can make this using the attribute ‘visible’, like this:




$this->widget('bootstrap.widgets.TbDetailView', array(

    'data' => $model,

    'type' => 'striped bordered condensed',

    'attributes' => array(

// I want to show bonus attribute if and only if its value is greater than 0

array('name'=>'bonus', 'value'=> $model->bonus,'visible'=>false,

),

));