Шаблон кода использования GridView в Yii2:
<?= \yii\grid\GridView::widget([ 'tableOptions'=>['class'=>'table table-striped'], 'summary'=>'', 'dataProvider' => $provider, 'showFooter'=>false, 'columns' => [ 'status'=>[ 'attribute' => 'amount', 'format' => 'raw', 'label' =>'Amount', ], 'val1'=>[ 'attribute' => 'val1', 'format' => 'raw', 'label' =>'VAL', ], 'info:ntext', [ 'label'=>'', 'format' => 'raw', 'value'=>function ($data) { $html = "Some html"; return $html ; }, ], ]); ?>
Шаблон ActiveForm:
<?php $form = \yii\widgets\ActiveForm::begin([ 'action'=>\yii\helpers\Url::to(['someaction/index']), 'fieldConfig' => [ 'template' => "<div class=\"form-group\"> {label} <div class=\"col-xs-6\">{input} {error}</div> </div>\n", 'labelOptions'=>['class' => 'some class for label'], ],]); ?> <?= $form->field($trade, 'val1',['selectors' => ['input' => '#trade2-val1']])->textInput(['class'=>'form-control','id'=>'trade2-val1']) ?> <?= $form->field($trade, 'amount',['selectors' => ['input' => '#trade2-amount']])->textInput(['class'=>'form-control','id'=>'trade2-amount']) ?>