I render a table using the GridView widget:
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
'subject',
// ...
],
]) ?>
I need to truncate the text displayed in the "subject" column and show it fully on hover, while also preserving the filter row search capability.
I managed to truncate the text using StringHelper::TruncateWords(), but couldn't figure out the filter row and the hover part:
[
'attribute' => 'subject',
'value' => function($model) {
$ret = \yii\helpers\StringHelper::truncateWords($model->subject, 5, '...', false);
return $ret;
}
],
Maybe there is a way to do this with pure Bootstrap without the need for StringHelper, but I wasn't able to make it work...