2015-11-21 16 views
1

Selectize.js會扭曲我的引導元素(儘管在功能方面沒有問題)。具體來說,有兩個問題。Selectize.js導致Bootstrap select元素格式問題

  1. 組合框區域,等等,一倍,一部分比另一
  2. 選項區域較窄的是某種形式的透明!!!

enter image description here

然而,它應該是這樣的,如果我切換selectize的 enter image description here

HTML:

<div class="form-group"> 
    <span style= "font-weight:bold" class="col-sm-1">Факт. адрес 
    </span> 
    <div class="col-sm-2"> 
     <div class="sandbox"> 
     <select id="fct_address_country_id" class="form-control input-sm" placeholder="Страна""> 
     </select> 
     </div>   
    </div> 
     .... 
</div> 

JS

var initializeSelectize = function(id, selectize_type, maxItems) { 

    if (typeof(maxItems)==='undefined') maxItems = 1; 
    switch(selectize_type) { 
     case 1: // SINGLE_ELEMENT_EXTENTABLE 
      $select = $(document.getElementById(id)).selectize({ 
       create: true, 
       maxOptions: MAX_OPTIONS}); 
      break; 
     case 2: // SINGLE_ELEMENT_PREDEFINED 
      $select = $(document.getElementById(id)).selectize({ 
       persist: false, 
       maxOptions: MAX_OPTIONS}); 
      break; 
     case 3: // MULT_ELEMENT 
      $select = $(document.getElementById(id)).selectize({ 
       maxItems: maxItems, 
       maxOptions: MAX_OPTIONS}); 
    } 
    return $select[0].selectize; 
} 

vendorsFctAddressCountryId_selectize = initializeSelectize ('fct_address_country_id', selectize_type.SINGLE_ELEMENT_PREDEFINED); 

只有另一個JQuery函數從數據庫填充組合框,但它顯然沒有任何與該問題有關的事情。

回答

0

我知道這是舊的,但偶然在這裏排查同樣的問題,所以也許爲未來的用戶:

檢查以下內容:

  • 你包括Selectize .css文件?
  • 將被選擇的輸入是否包含引導形式控制類?如果是這樣,請將其移除。
  • 可以選擇使用上Selectize初始化腳本選項:

    dropdownParent: 「身體」, inputClass: '形式制',

希望這有助於以同樣的問題的人。