html – Bootstrap multi-select – 使用Group Labels过滤问题

前端之家收集整理的这篇文章主要介绍了html – Bootstrap multi-select – 使用Group Labels过滤问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在Rails Web应用程序中使用 Bootstrap (2.3.2) multiselect.我在multlectlect中使用的功能如下所示:
<script type="text/javascript">
  $(function() { 
    $('#coder_prod_select_client').multiselect({
      includeSelectAllOption: true,enableCaseInsensitiveFiltering: true,numberDisplayed: 0,nonSelectedText: 'Select Facility',maxHeight: 450
    });
  });
</script>

以下是HTML代码

<div id="coder_prod_facilities_for_select">
    <select name="facility[]" multiple="multiple" id="coder_prod_select_facility" style="display: none;">
        <option value="multiselect-all"> Select all</option>
        <optgroup label="Group 1">
            <option value="114">Ancillary</option>
            <option value="115">Inpatient</option>
            <option value="117">Emergency</option>
        </optgroup>
        <optgroup label="Group 2">
            <option value="80">Inpatient</option>
            <option value="81">SS Surgery</option>
            <option value="90">Emergency</option>
        </optgroup>
        <optgroup label="Group 3">
            <option value="73">Inpatient</option>
            <option value="75">Observation</option>
            <option value="76">SS Surgery</option>
            <option value="77">Ancillary</option>
        </optgroup>
    </select>

    <div class="btn-group">
        <button data-toggle="dropdown" class="multiselect dropdown-toggle btn btn-default" type="button" title="Select Facility">
            Select Facility
            <b class="caret"></b>
        </button>
        <ul class="multiselect-container dropdown-menu" style="max-height: 450px; overflow-y: auto; overflow-x: hidden;">
            <div class="input-group">
                <span class="input-group-addon">
                    <i class="glyphicon glyphicon-search"></i>
                </span>
                <input type="text" class="form-control multiselect-search" placeholder="Search">
            </div>
            <li>
                <a href="javascript:void(0);" class="multiselect-all">
                    <label class="checkBox"><input type="checkBox" value="multiselect-all">  Select all</label>
                </a>
            </li>
            <li style="display: list-item;">
                <label class="multiselect-group">Group 1</label>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox"><input type="checkBox" value="114"> Ancillary</label>
                </a>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox"><input type="checkBox" value="115"> Inpatient</label>
                </a>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox"><input type="checkBox" value="117"> Emergency</label>
                </a>
            </li>
            <li style="display: list-item;">
                <label class="multiselect-group">Group 2</label>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox"><input type="checkBox" value="80"> Inpatient</label>
                </a>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox"><input type="checkBox" value="81"> SS Surgery</label>
                </a>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox"><input type="checkBox" value="90"> Emergency</label>
                </a>
            </li>
            <li style="display: list-item;">
                <label class="multiselect-group">Group 3</label>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox">
                        <input type="checkBox" value="73"> Inpatient</label>
                </a>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox"><input type="checkBox" value="75"> Observation</label>
                </a>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox"><input type="checkBox" value="76"> SS Surgery</label>
                </a>
            </li>
            <li style="display: list-item;">
                <a href="javascript:void(0);">
                    <label class="checkBox"><input type="checkBox" value="77"> Ancillary</label>
                </a>
            </li>
        </ul>
    </div>
</div>

您可以在下面看到默认的视图/ HTML.

您可以看到每个组下面都有类似的元素.例如,当我使用值’inpatient’进行过滤时,它显示的结果如下面的附件所示.

但是,每个过滤的“住院病人”值都属于不同的组,所有值都应该显示在它的组名称顶部!!,但事实并非如此.

有谁可以帮我识别并解决问题?

解决方法

你可能想再次检查js,不应该是$(“#coder_prod_select_facility”).multiselect(…)?
原文链接:/html/225668.html

猜你在找的HTML相关文章