[英]Yii CGridView search filter with array as data provider
I'm pretty new to Yii ( and frameworks all together ) and I'm trying to show the search results, that are contained inside an array, with GridView like this: 我对Yii(以及所有框架一起)还很陌生,并且我想使用GridView来显示包含在数组中的搜索结果,如下所示:
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id' => $model['res_id']
, 'dataProvider' => new CArrayDataProvider( $model['company'] )
, 'ajaxUpdate' => true
, 'itemsCssClass' => 'table table-bordered table-striped table-hover'
, 'pagerCssClass' => 'cni_pagination'
, 'pager' => array(
'htmlOptions' => array( 'class' => 'pagination' )
, 'header' => ''
)
));
?>
The results are show just fine: 结果显示很好:
But I'm struggling how to add the Search filter to this table. 但是我在努力将搜索过滤器添加到该表中。
All I could find is to add $model->search
to it, but, since my $model
is generated from an array, I can't use that. 我所能找到的就是在其中添加$model->search
,但是,由于我的$model
是从数组生成的,因此无法使用它。
Any suggestions how to do this? 有什么建议怎么做? Do I need to create additional class, that will define this? 我需要创建其他类来定义吗? A link to the correct manual will also help. 指向正确手册的链接也将有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.