kartik tabular form

How put each <input> in a row?




<?php

use kartik\grid\GridView;

use kartik\builder\TabularForm;

use yii\data\ArrayDataProvider;

use yii\helpers\Html;

use yii\widgets\Pjax;


Pjax::begin();

$dataProvider = new ArrayDataProvider([

    'allModels' => $row,

    'pagination' => [

        'pageSize' => -1

    ]

]);

echo TabularForm::widget([

    'dataProvider' => $dataProvider,

    'formName' => 'Address',

    'checkboxColumn' => false,

    'actionColumn' => false,

    'attributeDefaults' => [

        'type' => TabularForm::INPUT_TEXT,

    ],

    'attributes' => [

        "id" => ['type' => TabularForm::INPUT_HIDDEN, 'columnOptions'=>['hidden'=>true]],

        'cep' => ['type' => TabularForm::INPUT_TEXT, 'container' => ['div' => 'teste']],

        'street' => ['type' => TabularForm::INPUT_TEXT, 'container' => ['div' => 'teste']],

        'number' => ['type' => TabularForm::INPUT_TEXT, 'container' => ['div' => 'teste']],

        'complement' => ['type' => TabularForm::INPUT_TEXT],

        'district' => ['type' => TabularForm::INPUT_TEXT],

        'state_id' => [

            'label' => 'State',

            'type' => TabularForm::INPUT_WIDGET,

            'widgetClass' => \kartik\widgets\Select2::className(),

            'options' => [

                'data' => \yii\helpers\ArrayHelper::map(\app\models\State::find()->orderBy('name')->asArray()->all(), 'id', 'name'),

                'options' => ['placeholder' => Yii::t('app', 'Choose State')],

            ],

            'columnOptions' => ['width' => '200px']

        ],

        'city_id' => [

            'label' => 'City',

            'type' => TabularForm::INPUT_WIDGET,

            'widgetClass' => \kartik\widgets\Select2::className(),

            'options' => [

                'data' => \yii\helpers\ArrayHelper::map(\app\models\City::find()->orderBy('name')->asArray()->all(), 'id', 'name'),

                'options' => ['placeholder' => Yii::t('app', 'Choose City')],

            ],

            'columnOptions' => ['width' => '200px']

        ],

        'del' => [

            'type' => 'raw',

            'label' => '',

            'value' => function($model, $key) {

                return Html::a('<i class="glyphicon glyphicon-trash"></i>', '#', ['title' =>  Yii::t('app', 'Delete'), 'onClick' => 'delRowAddress(' . $key . '); return false;', 'id' => 'address-del-btn']);

            },

        ],

    ],

    'gridSettings' => [

        'panel' => [

            'heading' => '<span class="glyphicon glyphicon-book"></span> ' . Yii::t('app', 'Address'),

            'type' => GridView::TYPE_INFO,

            'before' => false,

            'footer' => false,

            'after' => Html::button('<i class="glyphicon glyphicon-plus"></i>' . Yii::t('app', 'Add Row'), ['type' => 'button', 'class' => 'btn btn-success kv-batch-create', 'onClick' => 'addRowAddress()']),

        ]

    ]

]);

Pjax::end();

?>




[color="#006400"]/* Moved from "General Discussions" to "Extensions" */[/color]