Answer the question
In order to leave comments, you need to log in
Conditions for outputting input?
There is a table that is formed like this
<?php Pjax::begin(); ?>
<?= GridView::widget([
'filterUrl' => Yii::$app->map->getByAlias('/mig.modules.admin.modules.users/list')->getUrl(),
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'group.name',
'title',
'name',
'value',
'typeof',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
<?php Pjax::end(); ?>
<tr data-key="4"><td>1</td><td>4</td><td>Регистрация</td><td>Требовать капчу?</td><td>isRequireCaptcha</td><td>5</td><td>boolean</td><td><a href="" title="View" aria-label="View" data-pjax="0"><span class="glyphicon glyphicon-eye-open"></span></a> <a href="" title="Update" aria-label="Update" data-pjax="0"><span class="glyphicon glyphicon-pencil"></span></a> <a href="" title="Delete" aria-label="Delete" data-confirm="Are you sure you want to delete this item?" data-method="post" data-pjax="0"><span class="glyphicon glyphicon-trash"></span></a></td></tr>
<?php $form = ActiveForm::begin(['fieldClass' => 'mig\themes\metronic\admin\widgets\ActiveField', 'options' => ['class' => 'form-horizontal']]); ?>
<?= $form->field($model, 'value', ['labelOptions' => ['class' => 'col-md-1 control-label']])->textInput(['maxlength' => true, 'class' => 'col-md-3']) ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('app', 'Сохранить'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
Answer the question
In order to leave comments, you need to log in
Option two. Or make a linked table or tables in which to store it. Or store as json in one cell, store data and field type. Depending on the type, display a dropdown or an input or some kind of widget. In the case of json, it will be impossible to sort or search by this cell, but it will be easier to implement.
In fact, there is a table with a typeof field in which the type of the field is indicated, the question is how to display this or that field in the view based on this field
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question