Yii Framework Forum: How to break output of GridView in a new line - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to break output of GridView in a new line [solved]

#1 User is offline   tklustig 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 332
  • Joined: 20-April 17
  • Location:Hannover

Posted 03 December 2017 - 03:24 PM

Hi guys,follwong code will read out content of email being in table. Content of mail is about several lines,of course, so my intention ist to break line(<br> '\n') after a point in mail(see my attachement) Do I have to use highly diverse string functions of php or can I achieve my intention with framework?
Any ideas, how to get my intention with yii2?
I Try like this, but this is not,as it should be

                      [
                'attribute' => 'bodytext',
                'label' => Yii::t('app', 'Mailinhalt'),
                'contentOptions' => [
                    'style' => ['max-width' => '200px;']],
                'value' => function($model) {
                    if ($model->bodytext) {
                        return $model->bodytext;
                    } else {
                        return NULL;
                    }
                },
            ],

Attached File(s)


0

#2 User is offline   umneeq 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 172
  • Joined: 10-October 11
  • Location:Russia

Posted 03 December 2017 - 03:46 PM

StringHelper::truncateWords()
0

#3 User is offline   tklustig 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 332
  • Joined: 20-April 17
  • Location:Hannover

Posted 03 December 2017 - 03:48 PM

View Postumneeq, on 03 December 2017 - 03:46 PM, said:

StringHelper::truncateWords()

Another solution could be like this:


    [

        'attribute' => $dummy,
        'label' => Yii::t('app', 'arbeitslos seit'),
        'format' => 'html',
        'contentOptions' => [
            'style' => ['width' => '150px;']
        ],
.
.

in
GridView::widget([
.
.

 	'options' => [
            'style' => 'overflow: auto; word-wrap: break-word;'
        ],
];

I just have found it here here
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users