CGridView CbutonColumn Custom Button Click not working

I am using a CGridView in which I have a CButtonColumn for which I have defined a button. the “click” js is not being called. The URL is called though and completes. I want to show a confirmation to the user but it never shows up. According to the documentation ‘click’ is a JS function to be called upon click but it is not working for me.


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

		'dataProvider'=>$model->search(),

		'filter'=>$model,

		'columns'=>array(

			'id',

			'name',

			'question',

			'created',			

			array(

				'class'=>'CButtonColumn',

				'header'=>'Reset',

				'template'=>'{reset}',

				'buttons'=>array(

					'reset'=>array(

						'label'=>'Reset',

						'click'=>'function(){alert("Are you sure?");}',

						'imageUrl'=>Yii::app()->request->baseUrl.'/images/reset.png',

						'url'=>'Yii::app()->createUrl("favs/reset", array("id"=>$data->id))',						

						'options'=>array(

							'ajax'=>array(

								'type'=>'POST',

								'url'=>"js:$(this).attr('href')",								

							),

						),

					),

				),			

			),			

		),

	));

may be try this javascript




if (confirm("Are you sure?")) {

	parent.location='http://www.example.ru/controller/action';



No still nothing. The click is not being called.

Resolved.

See this link