Somehow I can't change the column size in CGridView

If you specify a custom filter on each column, you can include the size of the input box.

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








                    'filter'=> CHtml::textField('type1',$model->type1,array('size'=>10)),



At least use headerHtmlOptions when setting column specific settings, you don’t need to set the width for each and every td.

This really is more of a html problem than a CGridView problem. What you need is the table-layout:fixed; rule in your table tag, and overflow with a with rule in your td tag.

Neither of these worked for me…

At least solved by adding max-wdith to css in assets\ff2aa0ca\gridview\style.css

grid-view table.items th, .grid-view table.items td


	font-size: 0.9em;

	border: 1px white solid;

	padding: 0.3em;

	max-width: 115px;


Excuse my English.

I had the same problem. Using htmlOptions in grid helped only for columns without filter field.

I tried in my styles.css:

.grid-view table.items tr.filters td 


  width: 50px;


And it helped.

  • I use bootstrap.widgets.TbGridView

  • no width in ‘htmlOptions’ in Grid

  • and 50px is minimum width of columns, real width depends propably on lenght of data. If I want more px, then I use width in ‘htmlOptions’.


hi friend if i write a comment like


than how to set it in grid column in a width is there is any option just to ignore wordwrap.?


I think I found the problem is in the file bootstrap.min.css, looking uneditable string-input {width: 206px}., And change the size to 50px (for example) and go.

Hope you solve the problem.


Try using min-width in style instead of width.

So it will be like this


In my case (with filter) I added

 'headerHtmlOptions'=>array('style'=>'width: 200px; display: block; padding: 16px 0;'),


'headerHtmlOptions'=>array('style'=>'padding: 0 50px;'),

And it works :)