Bootstrap-select在响应表中,页面始终向上滚动

问题描述 投票:0回答:1

我在一个表响应表的td中有一个引导选择。如果我单击选择选取器,则下拉菜单并不完全可见(可见性受表边距限制)。如果我添加data-container =“ body”(或作为官方准则,在data-container中添加其他元素),则页面将自动位于顶部,并且每次我必须向下滚动至表格时(下拉菜单正确打开并可见)。

<div class="table-responsive">  
  <table class="table" id="table">     
    <thead>
      <tr class="d-flex">
      <!-- others -->    
    </thead>    
    <tbody id="participants">
     <!-- others -->
      <td class="col-3">
        <select class="selectpicker" multiple data-live-search="true">
        <!-- options -->
        </select>
      </td>    
     </tbody>   
   </table>
</div>
html css bootstrap-4 bootstrap-select bootstrap-selectpicker
1个回答
0
投票

您没有遵循引导程序和表结构。我替换了修改后的代码:

<div class="container">
    <table class="table table-sm">
        <thead>
        <tr>
            <th scope="col">#</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <th scope="row">
                <select class="selectpicker form-control" multiple data-live-search="true">
                    <option>one</option>
                    <option>two</option>
                    <option>three</option>
                </select>
            </th>
        </tr>
        </tbody>
    </table>
</div>
© www.soinside.com 2019 - 2024. All rights reserved.