1
我將克隆搜索功能放入模型,在控制器中使用它傳遞給我的視圖使用CGridview,結果數據正確但過濾器停止工作,我看不出有什麼區別,所以必須有更多的東西來補充。這是我的代碼段: 型號:Yii Framework 1.1 .. CGridview過濾器不能使用我自己的搜索功能進入模型
public function searchCargo()
{
$criteria=new CDbCriteria;
$criteria->compare('cargoResp',1,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
控制器
$modRespSearchC=new Responsables('searchCargo');
$modRespSearchC->unsetAttributes();
if(isset($_GET['Responsables']))
$modRespSearchC->attributes=$_GET['Responsables'];
CGridView:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'responsables-grid1',
'dataProvider'=>$modRespSearchC->searchCargo(),
'filter'=>$modRespSearchC,
'columns'=>array(
'apell1Resp',
'apell2Resp',
'cargoResp',.....
我所懷念? 如何使用我自己的函數過濾器?
謝謝,很好的回答 – 2015-10-28 15:09:10