我想问一下,如何在yii 2中显示来自同一个表的两个表单,
example
<?php
$label1 = app\models\AppFieldConfigSearch::getLabelName(Location::tableName(), "Location");
?>
<?= $form->field($model, 'id_location')->label($label1) ?>
<?php
$label1 = app\models\AppFieldConfigSearch::getLabelName(LocationUnit::tableName(), "label1");
?>
<?= $form->field($model, 'label1')->label($label1) ?>
<?php $dataListAssetMaster2 = ArrayHelper::map(Owner::find()->asArray()->all(), 'id_owner', 'name');
echo $form->field($model, 'id_owner')->widget(Select2::classname(), [
'data' => $dataListAssetMaster2,
'pluginOptions' => [
'allowClear' => true
],
'options' => [
'prompt' => 'Pilih Nama']
])->label("Name");
?>
<?php $dataListAssetMaster4 = ArrayHelper::map(Location::find()->asArray()->all(), 'id_location', 'address');
echo $form->field($model, 'id_location')->widget(Select2::classname(), [
'data' => $dataListAssetMaster4,
'pluginOptions' => [
'allowClear' => true
],
'options' => [
'prompt' => 'Status Pembebasan']
])->label("location address");
//我的搜索模型
public function rules()
{
return [
[['id_location_unit', 'id_location', 'id_owner','id_mst_status1'], 'integer'],
[['label1', 'label2', 'label3', 'keterangan1', 'keterangan2', 'keterangan3','address'], 'safe'],
];
}
我想在1个搜索窗体上显示相同的2个表,但在使用代码时遇到问题,其中一个窗体没有出现
1条答案
按热度按时间dy2hfwbg1#
您可以将两个模型/表单合并为一个搜索模型。让您的搜索模型决定搜索逻辑。