Passing $Data Of Cgridview Row To View File

In cgridview button column I have buttons which when clicked passes $data of row to view file. How can I implement this?

Hi,

This will give you object of reach row.

$this->dataProvider->data[$row]

you can direcly access from controller like this

protected function gridYear($data) {

}

from view

$this->grid->controller->gridYear($data)

Thanks for the reply. Can you explain to me in detail, my situation is something like this. In _view.php I have cgridview and I want pass it $data for each selected row to _graph.php. In _view.php I have like this


$this->widget('bootstrap.widgets.TbTabs', array(	

'type'=>'pills', 

'tabs'=>array(

array('label'=>'Dash1', 'id'=>'dash1', 'items'=> array(

array('label'=>'Sub Dash1', 'id'=>'subdash1', 'content'=> $this->renderPartial('_graph', true, true)),

Hi

Where is your cgridview code… you gave me tab widget code… your question is not relevant to your code.Please give me clarification

here is my cgridview code


$this->widget('bootstrap.widgets.TbGridView', array( 	

'type'=>'striped bordered condensed', 	

'id'=>'siteaccess-grid', 	

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

'filter'=>$siteaccess, 	

'columns'=>array( 		

array('name'=>'ownerID', 'header'=>'Site Owner'), 		array('name'=>'siteID', 'header'=>'Site ID'), 		array( 			'class'=>'bootstrap.widgets.TbButtonColumn', 			'htmlOptions'=>array('style'=>'width: 10px'), 			'template'=>'{dashboard}', 			'buttons'=>array ( 				'dashboard' => array ( 					'label' => 'Open Dashboard', 					'click' => 'function(){ 						testing($(this).parent().parent().children(\':nth-child(2)\').text()); 					}',			 					'options' => array( 					    'data-toggle' => 'modal',  						'data-target' => '#myModal', 					),  					'icon' => 'briefcase', 					'csrf'=>true                 ), 			),	 		), 		), 	) ); 

here is my cgridview code


$this->widget('bootstrap.widgets.TbGridView', array(

'type'=>'striped bordered condensed',

'id'=>'siteaccess-grid',

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

'filter'=>$siteaccess, 	

'columns'=>array( 

  array('name'=>'ownerID', 'header'=>'Site Owner'),

  array('name'=>'siteID', 'header'=>'Site ID'), 

  array( 'class'=>'bootstrap.widgets.TbButtonColumn', 

      'htmlOptions'=>array('style'=>'width: 10px'), 

      'template'=>'{dashboard}', 

      'buttons'=>array ( 

      'dashboard' => array ( 

      'label' => 'Open Dashboard',

      'options' =>  array(

         'data-toggle' => 'modal', 

         'data-target' => '#myModal',),

      'icon' => 'briefcase', 

      'csrf'=>true),),),),)); 

Hi,

I am not clear about requirement… In which column do u want to pass the $data?

I want pass $data to view file which I am rendering in tabs as shown in earlier post.

Hi,

Please can you copy both _view and _graph content together… Not able to get your code.

This is part of my view code and I want to send $data to _graph.php file. Currently _graph.php is empty with just one line echo "hello world"

Hi,

What is the link between tab and gridview… Please can you post ur aplication screenshot… it will be easy to understand…

are you trying to use cgridview as content of one tab…?

are you trying to open tab by clicking link in cgridview ?

By clicking on link in cgridview, a modal window open in which I have 4 tabs and in one of the tab I am rendering _graph.php view. Now when I click the link I want to pass its $data to _graph.php view file.