Home > Backend Development > PHP Tutorial > Automatic search using drop-down menu in yii2 framework yii-widget-select2 example analysis

Automatic search using drop-down menu in yii2 framework yii-widget-select2 example analysis

WBOY
Release: 2016-07-29 09:07:08
Original
864 people have browsed it

The example in this article describes the method of automatically searching for yii-widget-select2 using the drop-down menu in the yii2 framework. 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 plug-in:

php composer .phar require kartik-v/yii2-widget-select2 "*"

Quotation method:

use kartikselect2Select2;

Source code:

<&#63;= $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.

The above introduces the analysis of the automatic search yii-widget-select2 using the drop-down menu in the yii2 framework, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template