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 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 267
  • 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 online   umneeq 

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

Posted 03 December 2017 - 03:46 PM

StringHelper::truncateWords()
0

#3 User is offline   tklustig 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 267
  • 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:

 	'options' => [
                'style' => 'overflow: auto; word-wrap: break-word;'
            ],
in
GridView::widget([
.
.
];

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