It would be great to have an option for a column in CgridView in order to give a maximum number of characters displayed in a cell. Moreover, if we can add “…” when this number is bigger, it’s better.
Today, it’s necessary to write a function which does the work.
yep, you can indeed write a function like you said, and that’s what I’m doing actually… but do it for every column is very boring… if there was an option in cgridview which took in account the number maximum of characters to display, it would be quicker and nicer than write array(name=>’…’,‘value’=>’…’) for every column.
You can extend CGridView, CDataColumn classes yourself and rewrite CGridView::initColumns(), CDataColumn::renderDataCellContent() methods. There is line in the CGridView::initColumns() method where CDataColumn instantiation happens. Text shortening can be made in the CDataColumn::renderDataCellContent() method.