Yii CGridView过滤器ajax更新未发生
Im使用CGridView显示记录。过滤器在我的应用程序中工作不正常。重新加载整个页面而不是Ajax更新。我想使用ajax调用过滤记录。这是我的密码Yii CGridView过滤器ajax更新未发生,yii,Yii,Im使用CGridView显示记录。过滤器在我的应用程序中工作不正常。重新加载整个页面而不是Ajax更新。我想使用ajax调用过滤记录。这是我的密码 $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'mage-grid', 'dataProvider'=>$model->search(), 'filter'=>$model, 'ajaxU
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'mage-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'ajaxUpdate'=>true,
'columns'=>array(
'entity_id',
'name',
'sku',
'type_id',
'price',
//'status',
array(
'name'=>'status',
'header'=>'Status',
'filter'=>array('1'=>'Enabled','2'=>'Disabled'),
'value'=>'($data->status=="1")?("Enabled"):("Disabled")'
),
array(
'class'=>'CButtonColumn',
'template' => '{update}{delete}',
// 'viewButtonUrl'=>'Yii::app()->controller->createUrl("/ad/view",array("id"=>$data["id"]))',
'buttons' =>array(
'update' => array(
'url'=>'Yii::app()->controller->createUrl("/mageproduct/update",array("pid"=>$data["entity_id"],"sid"=>SHOP_ID))',
'imageUrl'=>Yii::app()->request->baseUrl.'/images/icons/dark/create_write.png',
),
'delete' => array(
'url'=>'Yii::app()->controller->createUrl("/mageproduct/delete",array("pid"=>$data["entity_id"],"sid"=>SHOP_ID))',
'imageUrl'=>Yii::app()->request->baseUrl.'/images/icons/dark/trashcan.png',
// 'deleteConfirmation' => 'Delete?',
)
),
),
),
这是我的控制器动作
public function actionAdmin()
{
$model=new Mageproduct('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Mageproduct']))
$model->attributes=$_GET['Mageproduct'];
$this->render('admin' ,array(
'model' =>$model,
));
}
注:
我正在使用CArrayDataProvider。是否检查控制台是否有错误?也许你的代码中有一些其他的
JavaScript错误
,所以它阻止了ajax。是的,我检查过了。没有错误,我注意到表单是使用POST方法提交的。在网络中的javascript控制台中,您应该可以看到更新请求和该请求的结果。这个结果是一个完整的html页面还是仅仅是gridView?你应该让我们看看控制器,因为我认为问题就在那里!方法为post,请求为空,响应为完整的html页面。我添加了控制器操作。在另一个实例中,我注意到正在进行筛选,并且我注意到使用get方法传递值。但在我的项目中,它使用POST方法。如何更改此方法?问题就在于此?