数据保持选定="真"不工作

时间:2016-09-20 09:41:21

标签: javascript playframework bootstrap-table



<table id="table-manage-data-import-conflicts" data-classes="table table-hover table-condensed" data-cache="false" data-pagination="true" data-page-size="50" data-search="true" data-click-to-select="true" data-maintain-selected="true">
    <thead>
        <tr>
            <th data-field="id" data-visible="false"></th>
            <th data-field="recommendationPlacements" data-visible="false"></th>
            <th data-field="rules" data-visible="false"></th>
            <th data-field="isSelected" data-checkbox="true" data-formatter="BusinessPortal.Manage.DataImportConflicts.formatTableCheckBoxColumn"></th>
            <th data-field="name" data-switchable="false" data-sortable="true">Name</th>
            <th data-field="description" data-switchable="false" data-formatter="BusinessPortal.Manage.DataImportConflicts.formatTableDescriptionColumn" data-events="BusinessPortal.Manage.DataImportConflicts.handleTableDescriptionColumnEvents">Description</th>
        </tr>
    </thead>
</table>
&#13;
&#13;
&#13;

我使用的是bootstrap 1.9.1版。我想保持选中的项目与分页 data-maintain-selected="true"。 但它不会起作用。有人可以帮帮忙吗?

1 个答案:

答案 0 :(得分:0)

这与分页服务器/客户端不相关吗?

我不知道它是否对您有所帮助,但是,下面是我的代码并正在使用数据维护选择:“true”

     <table id="example"
     data-toggle="table"
     data-search="true"
     data-filter-control="true" 
     data-sort-name="Glider"
     data-show-refresh="true"
     data-sort-order="asc"
     data-show-export="true"
     data-click-to-select="true"
     data-maintain-selected="true"
     data-show-toggle="true" 
     data-show-columns="true" 
     data-pagination="true" 
     data-filter-control="true"
     cellspacing="0">

     <thead>
      <tr>
        <th data-field="1" data-field="state" data-checkbox="true"></th>
        <th data-field="Glider" data-filter-control="input" data-sortable="true">Glider</th>
        <th data-sortable="true" data-align="center" data-valign="middle" data-toggle="tooltip" data-placement="bottom" >A dist<i class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right" title="Average distance for all the flights made with the selected glider"></i></th>
        <th data-sortable="true">Pilots</th>
      </tr>
    </thead>
    <tbody>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name1</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name2</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name3</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name3</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name4</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name4</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name5</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name5</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name6</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name11221</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
      <tr class="Collapse">
        <td class="bs-checkbox "><input data-index="1" type="checkbox"></td>
        <td> Name111</td>
        <td> 1</b></td>
        <td> 2</td>
      </tr>
    </tbody>
  </table>