2016-10-04 92 views

回答

0

看看kartik/gridview

<?= 
 
    GridView::widget([ 
 
     'dataProvider' => $dataProvider, 
 
     'filterModel' => $searchModel, 
 
     'toolbar' => [ 
 
      ['content' => 
 
       Html::dropDownList('name', 'null', ['1' => 'Bulan ini', '2' => 'Bulan Lepas', '3' => 'Tahun ini', '4' => 'Tahun Lepas'], ['id' => 'gs1', 'class' => 'form-control']) 
 
      ], 
 
      '{export}', 
 
      '{toggleData}', 
 
     ], 
 
     'panel' => [ 
 
      'type' => GridView::TYPE_PRIMARY, 
 
      'heading' => $this->title, 
 
     ], 
 
     'columns' => [ 
 
      ['class' => 'yii\grid\SerialColumn'], 
 
      'ID', 
 
      ....., 
 
     ], 
 
    ]); 
 
    ?>

+0

限定面板I如果沒有,你不能看到你的下拉列表。 –

+0

但是當我可以定義類常量'TYPE_PRIMARY',因爲我得到錯誤'未定義的類常量'TYPE_PRIMARY'' –

+0

它的工作,謝謝 –

0

看看kartik/gridview

<?= 
 
    GridView::widget([ 
 
     'dataProvider' => $dataProvider, 
 
     'filterModel' => $searchModel, 
 
     'toolbar' => [ 
 
      ['content' => 
 
       Html::dropDownList('name', 'null', ['1' => 'Bulan ini', '2' => 'Bulan Lepas', '3' => 'Tahun ini', '4' => 'Tahun Lepas'], ['id' => 'gs1', 'class' => 'form-control']) 
 
      ], 
 
      '{export}', 
 
      '{toggleData}', 
 
     ], 
 
     'columns' => [ 
 
      ['class' => 'yii\grid\SerialColumn'], 
 
      'ID', 
 
      ....., 
 
     ], 
 
    ]); 
 
    ?>