Print Value From Selected Row Of Cgridview

Hi!

I need some help. When a row from CGridView is selected, I would like to print the second column value (Client Last name) from that row.

However, I’m not able to get the value from the column. Instead I get “object HTMLTableCellElement”

This is my code:




<script>

			

			function obtenerSeleccion(){

				var idCliente = $.fn.yiiGridView.getSelection('reclamos-cliente-grid');

				

				

				var selectedRowElements = $("#reclamos-cliente-grid .items tbody tr.selected td");

				if(selectedRowElements.length > 0 )

					alert(selectedRowElements[1]);


...

				



This is my grid widget




<?php 

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

				'id'=>'reclamos-cliente-grid',

				'selectableRows'=>1,

				'selectionChanged'=>'obtenerSeleccion',	// via 1: para mostrar detalles al seleccionar

				'dataProvider'=>Cliente::model()->search(),

				'filter'=>Cliente::model(),

				'columns'=>array(

					'idCliente',

					'apellidos',

					'nombres',

					'calle',

					'numeroPuerta',

					//'piso',

					//'dpto',

					'localidad',

					'provincia',

					//'codigoPostal',

					//'telefono',

					//'email',

					//'tipoPlan',

					//'observaciones',

					

					

				),

			));

		?>



Thanks!


alert(selectedRowElements[1].text());

Now I’m getting an error: HTMLTableCellElement does not have text property.

What I’m trying to do actually is: below the grid Cgridview, show “Selected client: CLIENT_LAST_NAME”

Perhaps there is a better way compared to what I’m trying to do.

I’ll apreciate your help.

Regards

I feel like you should probably be indexing from 0. I didn’t question that when copying your code originally. Try:


alert(selectedRowElements[0].text());

Thanks!