title: Can't find value in select2 ajax loading in yii2
body: <p>I use select2 ajax loading. I get the code from this link: <a href="http://demos.krajee.com/widget-details/select2" rel="nofollow">http://demos.krajee.com/widget-details/select2</a>. When I enter words into field, it display all data/value, but it can't automatic select data/value according to words that I enter into field. So, my select2 always select the first data/value and display all value. What's the problem? These are the codes:</p>
  
  <p>_form.php</p>
  
  <pre><code>$url = Url::to(['/paket/jsonlist']);
  
      $cityDesc = empty($model-&gt;no_induk) ? '' : Penerima::findOne($model-&gt;no_induk)-&gt;nama;
  
      echo $form-&gt;field($model, 'no_induk')-&gt;widget(Select2::classname(), [
          'initValueText' =&gt; $cityDesc, // set the initial display text
          'options' =&gt; ['placeholder' =&gt; 'Search for a city ...'],
          'pluginOptions' =&gt; [
              'allowClear' =&gt; true,
              'minimumInputLength' =&gt; 1,
              'language' =&gt; [
                  'errorLoading' =&gt; new JsExpression("function () { return 'Waiting for results...'; }"),
              ],
              'ajax' =&gt; [
                  'url' =&gt; $url,
                  'dataType' =&gt; 'json',
                  'data' =&gt; new JsExpression('function(params) { return {q:params.term}; }')
              ],
              'escapeMarkup' =&gt; new JsExpression('function (markup) { return markup; }'),
              'templateResult' =&gt; new JsExpression('function(no_induk) { return no_induk.text; }'),
              'templateSelection' =&gt; new JsExpression('function (no_induk) { return no_induk.id; }'),
          ],
      ]);
  </code></pre>
  
  <p>my controller:</p>
  
  <pre><code>public function actionJsonlist($q = NULL, $id = NULL)
      {
          \Yii::$app-&gt;response-&gt;format = \yii\web\Response::FORMAT_JSON;
          $out = ['results' =&gt; ['id' =&gt; '', 'text' =&gt; '']];
  
          if(!is_null($q))
          {
              $query = new \yii\db\Query;
              $mainQuery = $query-&gt;select('no_induk AS id, nama AS text')
                                 -&gt;from('penerima')
                                 -&gt;limit(20);
              $command = $mainQuery-&gt;createCommand();
              $data = $command-&gt;queryAll();
              $out['results'] = array_values($data);
          }
          elseif ($id &gt; NULL)
          {
              $out['results'] = ['id' =&gt; $id, 'text' =&gt; \frontend\models\Penerima::find($id)-&gt;nama];
          }
          return $out;
      }
  </code></pre>