The yii2 framework uses the drop-down menu to automatically search for yii-widget-select2 instance analysis, yii2widgetselect2. Use the drop-down menu to automatically search for yii-widget-select2 instance analysis in the yii2 framework, yii2widgetselect2 this article describes how to use the drop-down menu in the yii2 framework to automatically search for yii-widget-select2 instances using the drop-down menu in the yii-widget-selec yii2 framework, yii2widgetselect2
This article describes how to use the drop-down menu to automatically search for yii-widget-select2 in the yii2 framework. We will share this with you for your reference. The details are as follows:
Github source code address: https://github.com/kartik-v/yii2-widget-select2
Install this plug-in using composer. phar:
Php composer. phar require kartik-v/yii2-widget-select2 "*"
Reference method:
Use kartik \ select2 \ Select2;
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 ],]); ?>
A detailed explanation of related content: http://demos.krajee.com/widget-details/select2
I hope this article will help you design PHP programs based on the Yii Framework.
Articles you may be interested in:
- Yii2 uses the Bootbox plug-in to implement custom pop-up windows
- YII2 framework (IV) extension plug-in yii2-kartikgii from scratch
- YII2 framework (III) extension plug-in yii2-gird from scratch
- YII2 framework from scratch (2) Install extension plug-ins through Composer
- Method for using the Active Record mode in yii2
- Example of Activeform component usage in YII2.0
- How to add a verification code in yii2
- Method for referencing the date plug-in yii2-date-picker in bootstrap in the Yii2 framework
Examples of this article describes how to use the drop-down menu to automatically search for yii-widget-selec in the yii2 framework...