Linked Questions

Popular Questions

Yii2 Gridview afterRow function

Asked by At

Yii2 Gridview's afterRow calls an anonymous function after each data model. Is there a way the do an anonymous function only after the last data model? I want to add blank rows and the end.

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'id' => 'table',
    'tableOptions' =>[
        'class'=>'table table-condensed table-bordered'
    'afterRow' => function($model, $key, $index) {
        return Html::tag('tr',
            Html::tag('td', Html::textInput($name))
            .Html::tag('td', Html::textInput($name))

Related Questions