_php instance analysis of an automatic search Yii-widget-select2 instance in Yii2 frame using Pull-down menu

Source: Internet
Author: User
Tags yii

An example of this article describes the method of automatic search yii-widget-select2 using Pull-down menus in the YII2 framework. Share to everyone for your reference, specific as follows:

Source code address in GitHub: Https://github.com/kartik-v/yii2-widget-select2

Install this plugin with Composer.phar:

PHP Composer.phar require kartik-v/yii2-widget-select2 "*"

Reference method:

Use Kartik\select2\select2;

Source:

<?= $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
  ],
]); ?>

Detailed explanation of related content: Http://demos.krajee.com/widget-details/select2

I hope this article will help you with the PHP program design based on the YII 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.