C
C
Caspergreen2016-10-04 08:12:54
MySQL
Caspergreen, 2016-10-04 08:12:54

How to hide if value is false in TbGridView?

I'm trying to hide a cell, if the value is different from true, then it is required not to form

$this->widget('bootstrap.widgets.TbGridView', array(
  'id'=>'bs-scenario-grid',
  'dataProvider'=> $dataProvider,
        'columns'   => array(
            [
            'name'  => 'pub',
            'value' => function( $data ) {
                if ($data->pub == 1) {
                    return "true"; 
                } else if($data->pub == 0) { 
                    return "hidden"; 
                }
            }
            ],
        )

Controller -
$dataProvider = new CActiveDataProvider('RoomCat');
        $this->render("admin", array('dataProvider' => $dataProvider));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
enchikiben, 2016-10-04
@EnChikiben

Hide the table cell, this is something new))) if the value pub == 0 just return an empty string and that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question