我有一个标准的 Yii2 GridView 并想在两个不同的网格列中使用 Kartic Select2 小部件作为过滤器。但它只会在一列中显示一次。在第二列中,过滤器将为空。
[
'attribute' => 'facility_id',
'value' => 'facility.name',
'filter' => Select2::widget([
'model' => $searchModel,
'attribute' => 'facility_id',
'data' => ArrayHelper::map(Facility::find()->where('client_id = ' . $client->id)->orderBy('id DESC')->all(), 'id', 'name'),
'options' => ['placeholder' => ''],
'pluginOptions' => [
'allowClear' => true,
'width' => 'element',
],
]),
],
[
'attribute' => 'client_push_mail_id',
'value' => 'clientPushMail.name',
'filter' => Select2::widget([
'model' => $searchModel,
'attribute' => 'client_push_mail_id',
'data' => ArrayHelper::map(ClientPushMail::find()->where('client_id = ' . $client->id)->orderBy('id DESC')->all(), 'id', 'name'),
'options' => ['placeholder' => ''],
'pluginOptions' => [
'allowClear' => true,
'width' => 'element',
],
]),
],
检查 DOM: 两列都有下拉标记 (