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

Custom Parameters In Cgridview Button Url

$
0
0
Hi

I display a session-array in a gridview using CarrayDataProvider. So I can't use "normal" statements/functions to get the value of the id column.

In my gridview, I have this button with a customised url.

'buttons'=>array(
	'remove'=>array(
		'label'=>'Remove',

		'url'=>'$this->grid->controller->createUrl("remove", array(
			"idVal"	=> "jquery statement to get gridview column value",
			"parVal"=> "$parameter_received_from_the_controller",
		))',
		
		'click'=>'function(){
			confirm_delete(
				$(this).attr("href"),
				"Are you sure you want to REMOVE this record?"
			);
			return false;
		}',
	),
),


I have a few questions:
1. How do I use js/jquery to extract the data of a column to put in idVal?
2. How do I return a parameter to the controller in parVal (the parameter was first passed by the controller to the view )?
3. When do you include the entire url-generating-code in quotes ('url'=>'$this...' ) and when not ('url'=> $this...)?
4. With javascript in your buttons, when do you use ' ', " ", or nothing and js: ?

Thanx

Viewing all articles
Browse latest Browse all 18717

Trending Articles



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