Automatic search using drop-down menu in yii2 framework yii-widget-select2 example analysis, yii2widgetselect2
This article describes the example of automatic search using drop-down menu in yii2 framework yii-widget- select2 method. Share it with everyone for your reference, the details are as follows:
Source code address in github: https://github.com/kartik-v/yii2-widget-select2
Use composer.phar to install this plugin:
php composer.phar require kartik-v/yii2-widget-select2 "*"
Quotation method:
use kartikselect2Select2;
Source code:
<?= $form->field($model, 'companies_company_id')->widget(Select2::classname(), [
'data' => ArrayHelper::map(Companies::find()->all(),'company_id','company_name'),
'language' => 'en',
'options' => ['placeholder' => 'Select a state ...'],
'pluginOptions' => [
'allowClear' => true
],
]); ?>
Copy after login
Detailed explanation of related content: http://demos.krajee.com/widget-details/select2
I hope this article will be helpful to everyone’s PHP program design based on the Yii framework.
Articles you may be interested in:
- Yii2 uses Bootbox plug-in to implement custom pop-up windows
- Learn YII2 framework from scratch (4) Extension plug-in yii2-kartikgii
- Learn the YII2 framework from scratch (3) Extension plug-in yii2-gird
- Learn the YII2 framework from scratch (2) Install the extension plug-in through Composer
- Use Active Record mode in yii2 Method
- Usage example of Activeform form component in YII2.0
- Implementation method of adding verification code in yii2
- Yii2 framework refers to the date plug-in yii2-date-picker in bootstrap Method
http://www.bkjia.com/PHPjc/1089935.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1089935.htmlTechArticleAutomatic search using drop-down menu in yii2 framework yii-widget-select2 example analysis, yii2widgetselect2 This article describes the yii2 framework with examples Automatic search using drop-down menu in yii-widget-selec...