【问题标题】:Bootstrap multiselect引导多选
【发布时间】:2015-02-13 18:51:30
【问题描述】:

我正在使用 David bootstrap 多选 http://davidstutz.github.io/bootstrap-multiselect/,但我找不到在选中复选框时禁用标签修改的方法。例如。我的代码:

<select  multiple="multiple" name="more[]" id="more">
    <option value="Centres d'intérêt">Centres d'intérêt</option>
    <option value="Concession">Concession</option>
    <option value="Délai d'achat">Délai d'achat</option>
    <option value="Usage">Usage</option>
    <option value="Financement">Financement</option>
</select>

和 JS:

$('#more').multiselect({
                    includeSelectAllOption: false,
                    preventInputChangeEvent: true,
                    enableFiltering: true,
                    numberDisplayed: 1000,
                    maxHeight: 300,
                    nonSelectedText: "<span class='label-m'>{{ tran('admin/contacts/table.more') }}</span>",
                    allSelectedText: "<span class='label-m'>{{ tran('admin/contacts/table.more') }}</span>",
                    enableCaseInsensitiveFiltering: true,
                    templates:{
                        button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"  data-placement="bottom"></button>'
                    },
                    onChange: function(option, checked, select) {

                    }
                });

还有前面的how it lookshow it should look even when checkbox is checked

编辑: jsfiddle 演示:http://jsfiddle.net/y7c9zus1/3/

感谢您的所有回答!

【问题讨论】:

  • 你能用小提琴重现你的问题吗?

标签: jquery twitter-bootstrap bootstrap-multiselect


【解决方案1】:

您可以使用buttonText 选项:

buttonText: function (options, select) {
    //you also can count the selected options here to do whatever you want
    return 'My fixed label';
}

http://jsfiddle.net/vcarvalho/y7c9zus1/4/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-17
    • 1970-01-01
    • 2013-06-22
    • 1970-01-01
    • 2016-10-08
    • 2013-12-29
    • 2014-12-15
    • 2013-11-03
    相关资源
    最近更新 更多