Yii Framework Forum

Put grid view next to detail view in a view file


(Arunwebber) #1

I want to use my grid view in right hand side of my article (A view) How can i achive this?


(Jaimez) #2
  1. In controller action, add code to create data provider for GridView
    https://www.yiiframework.com/doc/guide/2.0/en/output-data-providers

  2. In view file, you can use bootstrap columns to display article and gridview next to it. So something like this:

<div class="row">
    <div class="col-md-6">
    ....your code to display the article....
    </div>
    <div class="col-md-6">
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
    ]); ?> 
    </div>
</div>

(Arunwebber) #3

@jaimez Yeah it has solved my issue