簡體   English   中英

select2和多個createSearchChoice

[英]select2 and multiple createSearchChoice

是否可以在select2中使用createSearchChoice方法同時創建2個選擇? 我正在為標簽創建輸入表單,如果標簽不存在,則需要同時創建兩個選項:例如,當用戶鍵入“ missingtag”時,他需要兩個選項

創建一個公共的“ missingtag”標簽
創建一個私有的“ missingtag”標簽

我看不到為什么您不能同時創建兩個標簽。 這不是testet,一部分是來自http://ivaynberg.github.io/select2/的 c / p。

    $("#tags").select2({
        createSearchChoice: function(term) { 
          return { data: {
                  {id:'public-' + term, text:'public-' + term },
                  {id:'private-' + term, text:'private-' + term}
              }
          }
    });

我解決了修改js文件中的createSearchChoice函數的問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM