Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

How to update CGridView with ajax?

$
0
0
I have searched for a solution long time.
Can anyone show me a simple example?
To keep things simple, I want to add names to table.
I have working autocomplete field and an ajax button, which adds name to the database through ajax.
After request is completed, table update should be triggered.

Currently I have no idea, how to use CGridViews properties. What should be returned? I found an example how to trigger update manually and that part works:

'success' => 'js:function(){$.fn.yiiGridView.update("athletes_'.$contest->id.'")}'));


Currently, grid widget creation looks like this:

<?php 
$this->widget('zii.widgets.grid.CGridView', array(
		'dataProvider' => $athletes,
		'ajaxUpdate' => 'contest_'.$contest->id,
		'id' => 'athletes_'.$contest->id,
		'ajaxUrl' => '/admin/contest/updateAthleteList/id/'.$contest->id,));
?>


Same code widget will be returned through ajax.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>