2017-12-28 27 views
1

EasyAutocompleteプラグインを使用して自動検索ボックスを使用していますが、1つのタイプのみを検索するとプラグインが正常に動作します。今これは複数の値を持つEasyAutocompleteプラグインでオートコンプリート検索入力

var options = { 
     url: "https://coincap.io/front", 

     getValue: "long", 

     template: { 
      type: "description", 
      fields: { 
       description: "short" 
      } 
     }, 

     list: { 
      match: { 
       enabled: true 
      }, 

     }, 

     theme: "plate-dark" 
    }; 

    $("#searching").easyAutocomplete(options); 

:私はここ

は私のコードです..私は、私は名前、または姓などにより、すなわち複数の値、で検索できることを望む一方で、私は、検索するオプションを1つだけ持っている意味します私は暗号通貨の値を取得し、現在は longという名前で検索していますが、正常に動作しますが、 shortという名前でも検索したいと考えています。

私の悪い英語のために申し訳ありません..あなたは私の問題を願っています。 ありがとう

答えて

1

このプラグインは関数を使用することができ、関数を使ってこれを行うことができます。

var options = { 
    url: "https://coincap.io/front", 

    getValue: function(element){ 
       return element.long+" - "+element.short; 
       }, 
    /* 
    template: { 
     type: "description", 
     fields: { 
      description: "short" 
     } 
    }, */ 

    list: { 
     match: { 
      enabled: true 
     }, 

    }, 

    theme: "plate-dark" 
}; 

$("#searching").easyAutocomplete(options); 
関連する問題