Use the drop-down menu to automatically search for yii-widget-select2 instance analysis in the yii2 framework, yii2widgetselect2_PHP tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.