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

Source: Internet
Author: User
: This article mainly introduces the yii2 framework using drop-down menu of automatic search yii-widget-select2 instance analysis, for PHP tutorials interested in students can refer. 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' => ['holder' => 'Select a state... '], 'ininoptions' => ['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.

The above introduces the yii2 framework using the drop-down menu of automatic search yii-widget-select2 instance analysis, including the content of the aspect, hope to be interested in PHP Tutorial friends help.

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.