为了账号安全,请及时绑定邮箱和手机立即绑定

如何将类名或数据-* 添加到 widgetof "nex/yii2-chosen"

如何将类名或数据-* 添加到 widgetof "nex/yii2-chosen"

PHP
手掌心 2023-04-02 14:56:38
我正在使用“nex/yii2-chosen”,我们如何在下面的示例中添加“class”属性或“data-*”<?=$form->field($model, "vehicle_id")->widget(Chosen::className(), [    'items' => $VehicleList,    'disableSearch' => 5,    'class' => 'vehicle_id form-control input-sm',    <---------------not working    'clientOptions' => [        'search_contains' => true,        'single_backstroke_delete' => false,    ]]) ?>
查看完整描述

1 回答

?
蝴蝶不菲

TA贡献1810条经验 获得超4个赞

您只需要将它们放在options财产中即可。


<?=

$form->field($model, "vehicle_id")->widget(Chosen::className(), [

    'items' => $VehicleList,

    'disableSearch' => 5,

    'options' => [

        'class' => 'vehicle_id form-control input-sm',

    ],

    'clientOptions' => [

        'search_contains' => true,

        'single_backstroke_delete' => false,

    ]

]) ?>


查看完整回答
反对 回复 2023-04-02
  • 1 回答
  • 0 关注
  • 64 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信