Z
Z
ZaurK2017-05-27 19:28:52
Yii
ZaurK, 2017-05-27 19:28:52

How to properly format output records in yii2?

Greetings! When using the DetailView widget, I set the value of the description:ntext attribute and the text is displayed normally with line breaks. When using the ListView widget, I did not find a similar attribute, the code is something like this

ListView::widget([
    'dataProvider' => $dataProvider,
    'itemView' => '_workitem',
    'summary' => false,
]);

Outwardly, it looks like a list when you click on some element of which a pop-up window pops up with a description in it.
Here, when passing data to the _workitem view, I display the data like this . The problem is that in the pop-up window I get text without line breaks, although when viewed in the database there are breaks and where the DetailView is used, there are also breaks. Tell me how can I make it so that there are hyphens in the pop-up window?
<?= Html::encode($model->gdescription) ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-05-27
@ZaurK

Good evening.
Try like this:
And in this case, it is not necessary to use encode. encode handling is in asNtext()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question