title: How to display action button as dropdown in Yii2 gridview?
body: <p>I would like to display action button as dropdown in Yii 2 gridview. How can I achieve that without using any extension? </p>
  
  <p>I have added the source code bellow-</p>
  
  <pre><code>&lt;?= GridView::widget([
      'dataProvider' =&gt; $dataProvider,
      'filterModel' =&gt; $searchModel,
      'columns' =&gt; [
                  ['class' =&gt; 'yii\grid\SerialColumn'],
  
                  'id',
                  'name',
  
                  ['class' =&gt; 'yii\grid\ActionColumn',
                      'template'=&gt;'{view}{update}{delete}',
                      'buttons' =&gt; [
                          'view' =&gt; function ($url, $model) {
                              return Html::a('&lt;span class="glyphicon glyphicon-eye-open"&gt;&lt;/span&gt;', $url, [
                                  'title' =&gt; Yii::t('app', 'View'),
                              ]);
                          },
                          'update' =&gt; function ($url, $model) {
                              return Html::a('&lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;', $url, [
                                  'title' =&gt; Yii::t('app', 'Update'),
                              ]);
                          },
                      ],
  
                      'urlCreator' =&gt; function ($action, $model, $key, $index) {
                          if ($action === 'view') {
                              $url ='/site/view?id='.$model-&gt;id;
                              return $url;
                          }
                          if ($action === 'update') {
                              $url ='/site/update?id='.$model-&gt;id;
                              return $url;
                          }
                      }
                  ],
      ],
  ]); ?&gt;
  </code></pre>