Changing the width of a filter column in CGridview

I recently spent an hour or so trying to reduce the width of columns in a CGridView. As I was trying to squash the grid into a narrow space, I wanted some columns to be narrower than others.

I tried setting the headerHtmlOptions and the HtmlOptions and I could see these coming through in the HTML but found that it was the width of the input boxes in the filter row that was throwing out width of the column.

I finally found a solution that works (for me). I know this is a bit of a hack but it works! 

    max-width: 55px;
Filter width Yii Gridview

Did you know you can hire me?

I take on projects of all sizes. From Consulting to large Development Projects.

If you're starting a new Yii project and would like some help to get setup and running or you need some help with a particular module or you just need someone to develop the whole dang thing, then just ask ...

Leave a Comment