bootstrap-select 单选、多选设置

bootstrap-select 单选、多选设置

  • 有multiple属性:多选
  • 无multiple属性:单选

单选

<div class="form-group">
                            <label for="orgId" class="col-sm-3 control-label">所属部门label>
                            <div class="col-sm-9">
                                <select class="selectpicker" id="orgId" name="orgId"
                                    data-width="100%">
                                    <optgroup label="${organizations[0].orgName}">
                                        <c:forEach var="organization" items="${organizations}"
                                            begin="1">
                                        ${organization.hierarchy}
                                        <c:if test="${organization.hierarchy == 2}">
                                    optgroup>
                                    <optgroup label="${organization.orgName}">
                                        c:if>
                                        <option value="${organization.id}">${organization.orgName}option>
                                        c:forEach>
                                    optgroup>
                                select>
                            div>
                        div>

多选

<div class="form-group">
                            <label for="orgId" class="col-sm-3 control-label">所属部门label>
                            <div class="col-sm-9">
                                <select class="selectpicker" multiple  id="orgId" name="orgId" data-width="100%">
                                    <optgroup label="${organizations[0].orgName}">
                                    <c:forEach var="organization" items="${organizations}" begin="1">
                                        ${organization.hierarchy}
                                        <c:if test="${organization.hierarchy == 2}">
                                            optgroup>
                                            <optgroup label="${organization.orgName}">
                                        c:if>
                                        <option value="${organization.id}">${organization.orgName}option>
                                    c:forEach>
                                    optgroup>
                                select>
                            div>
                        div>

参考资料:
http://www.kuitao8.com/demo/20140224/1/bootstrap-multiselect-master/index.html

你可能感兴趣的:(◆框架学习)