YII: Custom refresh zii.widgets.grid.CGridView after updating database

Your PHP code

$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'YOUR_UNIQUE_ID',
    'dataProvider' => $model->search(),
    so on...

For Javascript:
Should you call this function to update the table/grid thru ajax.


	function refreshMaterialLinkGrid(){
		$.fn.yiiGridView.update('YOUR_UNIQUE_ID', {
			type:'POST',
			url:document.URL+'?_s='+uniqid('cache',true),  //uniqid can be seen at phpjs.org
			success:function(data) {
				$.fn.yiiGridView.update('YOUR_UNIQUE_ID');
			}
		});
	}

Tags:

Comments are closed.