Skip to content

vov4ik08/yii2-select2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#This widget for you select2 v3.4.5 (http://ivaynberg.github.io/select2/) Usage

/*  $form->field($model, 'users_to')->widget(\Apollo\Select2Field::className(), [

        'clientOptions' => [
            'allowClear' => true,
            'language' => 'ru',
            'maximumSelectionSize'=>'3',
            'multiple' => 'false',
            'minimumInputLength' => '3',
              'placeholder'=>"Search for a movie",
            'ajax' => [
                'url' => Yii::$app->urlManager->createUrl('URL'),
                'dataType' => 'json',
                'data' => new yii\web\JsExpression('function (term) {

                                                    return {
                                                        username: term, // search term

                                                        } ;
 }'),



                'results' => new yii\web\JsExpression('function (data) { // parse the results into the format expected by Select2.
 var myResults = [];
$.each(data, function (index, item) {
 myResults.push({
 id: item.id,
  text: item.FIO + " " + (item.login)
 });

});
                                            return {

                                              results: myResults
                                                 };
 }')


            ],

        ]

    ])

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published