How to disable AJAX in CGridView or CListView

Hi everybody,

I don’t like using ajax in admin page (with CGridView) because it has some problem with bookmarking. So I want to disable it. But I can’t find the property to do that, according to the api reference.

http://www.yiiframework.com/doc/api/CGridView

Thanks for any help.

hi,

try to pass ajaxUpdate=>‘false’ in your CGridView widget

[not tested]

best,

b

Thanks a lot. It really work! :)

Don’t work for me…

I have this code:


$this->widget('zii.widgets.grid.CGridView', array(

	'dataProvider'=>$dataProvider,

        'ajaxUpdate'=>'false',        

	'columns'=>array(

 	...),


),



Take the quotes away from around false. Eg.


$this->widget('zii.widgets.grid.CGridView', array(

	'dataProvider'=>$dataProvider,

        'ajaxUpdate'=>false,        

	'columns'=>array(

 	...),


),



Hello,

I have tried this but the problem that I face is that the gird is still using Ajax to delete records. The grid generates the following javascript





jQuery('#Orders-grid a.delete').live('click',function() {

	if(!confirm('Are you sure you want to delete this item?')) return false;

	$.fn.yiiGridView.update('Orders-grid', {

		type:'POST',

		url:$(this).attr('href'),

		success:function() {

			$.fn.yiiGridView.update('Orders-grid');

		}

	});

	return false;

});



Is it possible to remove all of the ajax?

In templates set you own template ‘{mydeletebutton}’




'columns'=>array{


 array(  

'class'=>'CButtonColumn',

'template'=>'{mydeletebutton}',

'buttons'=>array(

'mydeletebutton' => array(

    'label'=>'...',     // text label of the button

    'url'=>'...',       // a PHP expression for generating the URL of the button

    'imageUrl'=>'...',  // image URL of the button. If not set or false, a text link is used

    'options'=>array(...), // HTML options for the button tag

    'click'=>'...',     // a JS function to be invoked when the button is clicked

    'visible'=>'...',   // a PHP expression for determining whether the button is visible

),

),

),

),




you have to change the http://www.yiiframework.com/doc/api/1.1/CButtonColumn

because delete click is allredy predifined so you cant change it :(




 array(  

'class'=>'CButtonColumn',

'template'=>'{delete}',

'buttons'=>array(

'delete' => array(

    'click'=>'',     // a JS function to be invoked when the button is clicked

),

),

),

),