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

Experienced Software Engineer with a demonstrated history of working in the marketing and advertising industry. Skilled in SQL, Web Applications, PHP, WordPress, and Joomla. Strong engineering professional with a B-TECH focused in Information Technology from JCDM College of Engineering Sirsa, Haryana.

More posts by Pankaj Singh Sugara