2017-02-21 1 views
0

私はBootstrap Multiselect jqueryプラグインを使用しています。 私の問題は、ユーザーがすべてのオプションを選択した場合、私は第六のオプションを選択すると、それは実際にこのBoostrap Multiselectが "All Selected"を削除し、実際にすべての選択を表示

チーズ、トマト、モッツァレラチーズ、マッシュルーム、ペパロニ、玉ねぎ代わり

、などのすべての選択を表示したいです、それが表示される。この

すべて(6)

はここに私のコードの選択し

<select id="example-numberDisplayed" multiple="multiple"> 
    <option value="cheese">Cheese</option> 
    <option value="tomatoes">Tomatoes</option> 
    <option value="mozarella">Mozzarella</option> 
    <option value="mushrooms">Mushrooms</option> 
    <option value="pepperoni">Pepperoni</option> 
    <option value="onions">Onions</option> 

</select> 

$(document).ready(function() { 

    $('#example-numberDisplayed').multiselect({ 
    numberDisplayed: 6 
    }); 
}); 

助けてください。事前にお礼します

答えて

0

これを達成するには、multi selectのJavaスクリプトファイル、つまりbootstrap-multiselect.jsのコードを変更する必要があります。ライセンスが許されているかどうかはわかりません。 しかし、buttonText関数で次のコードをコメントや削除すると、選択したすべての状況が表示されることはありません。

else if (this.allSelectedText 
        && options.length === $('option', $(select)).length 
        && $('option', $(select)).length !== 1 
        && this.multiple) { 

       if (this.selectAllNumber) { 
        return this.allSelectedText + ' (' + options.length + ')'; 
       } 
       else { 
        return this.allSelectedText; 
       } 
      } 
+0

ご返信ありがとうございます。私は allSelectedText追加することによってそれを行うために管理:コード $( '#例-numberDisplayed')に偽 を複数選択({ numberDisplayed:12、のmaxHeight:300、allSelectedText:偽 })。 – Joel

+0

ああ、私はallSelectedTextの設定を知りませんでした。ありがとう – wanderer

関連する問題