我在 Yii 下通过 bootstrap.widgets.TbGridView 创建了一个四列的 GridView,就像
|name | age | sex | birthday |
|----------------------------|
|( )|( )|( )|( )|
|----------------------------|
|Lo |1 |f |24/05 |
和 ( ) 表示搜索框,所以现在我想隐藏年龄的搜索框,使其看起来像这样:
|name | age | sex | birthday |
|----------------------------|
|( )| |( )|( )|
|----------------------------|
|Lo |1 |f |24/05 |
谁能告诉我如何用 Yii 做这件事?
$this->widget('bootstrap.widgets.TbGridView', array(
'type' => 'condensed',
'id' => 'provider-grid',
'dataProvider' => $model->search(),
'filter' => $model,
'columns' => array(
'name',
'email',
array('name' => 'created_at', 'filter' => false), // solved by this
array('name' => 'updated_at', 'filter' => false), // solved by this
array(
'class' => 'bootstrap.widgets.TbButtonColumn',
'htmlOptions' => array(
//'nowrap' => 'nowrap'
),
'template' => '{login} {view} {update} {delete}', // https://github.com/yiisoft/yii/blob/1.1.13/framework/zii/widgets/grid/CButtonColumn.php#L46
'buttons' => array(
'login' => array(
'label' => Yii::t('bus', 'Login to Administrator Site'),
'options' => array(
'title' => Yii::t('bus', 'Login to Administrator Site'),
'target' => '_blank'
),
'url' => 'Yii::app()->createUrl(
"/administrator/default/index",
array(
"provider_id" => $data->id
)
)',
'icon' => 'share'
),
)
),
),
));