Prevent word wrap in Yii CGridView column

Sometime there are long data need to be displayed in Yii’s cgridview and you don’t want it to be wrapped. This can be achieved by setting appropriate CSS/style in the particular cell or column, for example specifying the width or nowrap.

$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'my-grid',
	'dataProvider'=>$model->search(),
	'columns'=>array(
		array(
			'name'=>'LongAssetTag',
			'htmlOptions' => array('style' => 'white-space: nowrap;')
		),
		......
	),
));

Comments

comments