I am traing to display two attributes in a single GridView::widget column, with a new line in between them.
Below is the code, but the "\n". or br tag is not converting into new line. Is there any alternative way?
[
'label' => 'Message',
'attribute' => 'message',
'value' => function ($searchModel) {
return Yii::$app->formatter->asNtext($searchModel->message)."\n".Yii::$app->formatter->asDatetime($searchModel->sent_time);
},
],
New Line in between attribute values
No new line in between attributes
| Q | A |
| --- | --- |
| Yii version | Latest |
| PHP version | 7 |
| Operating system | Linux |
Thank you for your help
the output will be html so you should use a <br>
instead of \n
.
_This is an automated comment, triggered by adding the label question
._
Please note, that the GitHub Issue Tracker is for bug reports and feature requests only.
We are happy to help you on the support forum, on IRC (#yii on freenode), or Gitter.
Please use one of the above mentioned resources to discuss the problem.
If the result of the discussion turns out that there really is a bug in the framework, feel free to
come back and provide information on how to reproduce the issue. This issue will be closed for now.
@cebe Thank you for your help.
'format' => 'html',
with a <br>
tag fixed the issue.
Most helpful comment
@cebe Thank you for your help.
'format' => 'html',
with a<br>
tag fixed the issue.