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

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

WBOY
Release: 2016-07-12 09:01:08
Original
1186 people have browsed it

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

This article describes the example of automatic search using drop-down menu in yii2 framework yii-widget- select2 method. 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 plugin:

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
  ],
]); &#63;>

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.

Articles you may be interested in:

  • Yii2 uses Bootbox plug-in to implement custom pop-up windows
  • Learn YII2 framework from scratch (4) Extension plug-in yii2-kartikgii
  • Learn the YII2 framework from scratch (3) Extension plug-in yii2-gird
  • Learn the YII2 framework from scratch (2) Install the extension plug-in through Composer
  • Use Active Record mode in yii2 Method
  • Usage example of Activeform form component in YII2.0
  • Implementation method of adding verification code in yii2
  • Yii2 framework refers to the date plug-in yii2-date-picker in bootstrap Method

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1089935.htmlTechArticleAutomatic search using drop-down menu in yii2 framework yii-widget-select2 example analysis, yii2widgetselect2 This article describes the yii2 framework with examples Automatic search using drop-down menu in yii-widget-selec...
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