I use yii and Yii Booster.
I want to truncate text displayed in a TbEditableColumn. I have extended CFormatter as described here: .
In order to truncate text I set in my column definition attribute 'type' to array('type'=>'shortText', length=>20)
//gridview
'columns'=>array(
array(
'type' => array(
'type' => 'shortText',
'length' => 10
),
),
)
It works fine in columns that are NOT editable. It doesn't work when I set:
'class' => 'bootstrap.widgets.TbEditableColumn'
Any idea how to make it work with TbEdiableColumn?
Now that's been a brain tickler. Although
TbEditableColumn
ultimately extendsCDataColumn
, it does not respect the grid view's formatter at all if it is able to apply theTbEditableField
widget to the data cell.TbEditableField
has atext
property controlling the displayed text in the data cell (that is, before you clicked it). Unfortunately, it seems to be static. It never gets evaluated in any form, so you can't pass an expression or an anonymous function to it.Bottom line: Can't be done unless you're teaching
TbEditableField
how to pull in formatters by extending it.TbEditableColumn
would have to be extended as well so it'll pass the formatter instance.