DataGridView Text Wrap in Yii2 framework

By January 11, 2016YII

In Yii2 by using “contentOptions” we can easily warp the text

<?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            //'id',
            [
              'attribute' => 'question',
              'value'=>'question',
              'contentOptions'=>['style'=> 'max-width: 300px;', 'height: 100px']
            ],
]); ?>
Pankaj Singh Sugara

Author Pankaj Singh Sugara

More posts by Pankaj Singh Sugara