【发布时间】:2016-03-07 12:30:26
【问题描述】:
我已尝试使用 array_filter(),但它仍然不适用于已发布/未发布的列。实际上,当搜索字段不为空时,我想隐藏具有移动图标的列
public function actionAdmin()
{
$model=new InfoCategories('search');
$model->unsetAttributes(); // clear any default values
$model->del_flg=0;
$enableSorting = TRUE;
if (isset($_GET['InfoCategories'])) {
$model->attributes=$_GET['InfoCategories'];
if(array_filter($_GET['InfoCategories'])){
$enableSorting = FALSE;
}
}
$statusList = array("0"=>t("common","UnPublished"), "1"=>t("common","Published"));
$this->render('admin',array(
'model'=>$model,
'statusList'=>$statusList,
'enableSorting'=> $enableSorting,
));
}
【问题讨论】:
-
我们可以在array_filter()中使用strlen作为回调函数