0

I have a detailview table and i'd like to add another column but not sure how. At the moment it only has sort of 2 columns; one with the attribute label, and the other one with the actual data.

<div class="col-md-4" >                       
                    <div class="panel rounded shadow panel-theme">
                        <div class="panel-heading">
                            <div class="pull-left">
                                <h3 class="panel-title">Notifications</h3>
                            </div>
                            <div class="pull-right">
                                <button class="btn btn-sm" data-action="collapse" data-toggle="tooltip" data-placement="top" data-title="Collapse" data-original-title="" title=""><i class="fa fa-angle-up"></i></button>
                            </div>
                            <div class="clearfix"></div>
                        </div><!-- /.panel-heading -->
                        <div class="panel-body">
                            <?=
                            DetailView::widget([
                                'model' => $model,
                                'attributes' => [
                                [
                'attribute'=>'Notifications',
                'format'=> 'raw',
                'value' => implode($comments)
                    ],
                                    
                                ],
                            ])
                            ?>

                        </div><!-- /.panel-body -->
                    </div>

                </div>
  • 1
    This is the purpose of that widget to display data like that: attribute - value. You need some custom new one for other design. – Bizley Aug 10 '20 at 10:22
  • Thanks @Bizley. Do you know if maybe there is a way I can concatenate data then within the same column? – Rachel Fitz Aug 10 '20 at 10:52
  • Yes, you can do it, add array configuration for your "attribute" (like in your example) and provide the output for the `value` key like `'value' => $model->prop1 . $model->prop2` – Bizley Aug 10 '20 at 10:59
  • @Bizley it's not letting me coz of the implode :( – Rachel Fitz Aug 10 '20 at 11:28
  • I don't understand what is the problem here, `implode` shouldn't be an issue. – Bizley Aug 10 '20 at 11:30
  • @Bizley I am trying like this but they layout is not coming good :( I want the dates to be next to the comments in which they were written. Sorry but I am new to this 'value' => implode($comments) . implode($dates) – Rachel Fitz Aug 10 '20 at 11:33
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/219541/discussion-between-rachel-fitz-and-bizley). – Rachel Fitz Aug 10 '20 at 11:38

0 Answers0