How to add id column in gridview

Hii… masters, How to add id in column in gridview ???

HTML id? http://www.yiiframework.com/doc/api/1.1/CGridColumn#id-detail

Ok thank. but I can’t implementation it.

how to use it ? please post the code…; :lol: :lol:




'columns' => array(

  ...

  array(

    ...

    'header' => 'Header',

    'value' => 'Value',

    'id' => 'column_id',

    ...

  )

  ...

)



ok I have tried it but it’s not random, I want id same as id of data,…

thank for help me

Hmmm … Why do you need it? For JavaScript? If yes you can use $.fn.yiiGridView.getKey jQuery function:




	$('.grid-view table tbody tr').live('click', function() {

		var id = $.fn.yiiGridView.getKey(

			$(this).closest('.grid-view').attr('id'),

			$(this).prevAll().length

		);

		window.location = viewUrl + id;

	});