Yii 1.0 CGridView Code Demo

{Code}

 

$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'map-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
//		'id',
    array('name'=>'id', 'headerHtmlOptions'=>array('width'=>'22px')),
//		'map_name',
    array('name'=>'map_name', 'type'=>'raw', 'value'=>'CHtml::link($data->map_name, array("Map/View","id"=>$data->id),array("target"=>"_blank"))','htmlOptions'=>array('width'=>140)),
    array('header'=>'版本资料', 'type'=>'raw', 'value'=>'CHtml::link("查看版本", array("version/versionTotal","mid"=>$data->id),array("target"=>"_blank"))'),
    'create_time',
//    array('name'=>'game_type_id','value'=>'GameType::model()->getGameTypeName($data->game_type_id)','filter'=>GameType::model()->getGameTypeList()),
//    array('name'=>'map_type_id','value'=>'MapType::model()->getMapTypeName($data->map_type_id)','filter'=>MapType::model()->getMapTypeList()),
//    array('name'=>'language_type_id','value'=>'LanguageType::model()->getLanguageTypeName($data->language_type_id)','filter'=>LanguageType::model()->getLanguageTypeList()),
//    array('name'=>'public_type_id', 'value'=>'PublicType::model()->getPublicTypeName($data->public_type_id)', 'filter'=>PublicType::model()->getPublicTypeList()),
//    'status_type_id',
//    array('name'=>'status_type_id', 'value'=>'StatusType::model()->getStatusTypeName($data->status_type_id)', 'filter'=>StatusType::model()->getStatusTypeList()),

    array('name'=>'num_download_week','filter'=>false),
    array('name'=>'num_download_all','filter'=>false),
//    array('name'=>'create_time', 'value'=>'date("Y-m-d",$data->create_time)'),
//		'update_user_id',

		/*
		'map_players_type',

		... ...

		'num_vote_sum',
		'num_vote_times',
		'num_comment',
		*/

	),
));

{Boy Say}

I have to cut some code out, because it's too large, and some of them are just repeat.

anyway, this is a code from product mode, so change then use. ^&^