简体   繁体   English

在简单的html表中的下拉列表框中选择选择时记录显示

[英]Record show on select on drop down box in simple html table

i want to show the records based on drop-down box if i select 25 than 25 records should be show in table if i salect 50 than 50 record should be show in table and so on. 如果我选择25比25的记录应该在表中显示,如果我选择50比50的记录在表中显示,我想根据下拉框显示记录。

here is my drop down html code. 这是我的下拉HTML代码。

</select>
<div class="pull-right">Show
 <select class="drop_box">
  <option label="Select View List">10</option>
<option label="25">25</option>
  <option label="50">50</option>
  <option label="100">100</option>
    <option label="10">All</option>
</select>
records per page</div>

Here is my table html code.Here i show only few records. 这是我的表格html代码。在这里我只显示很少的记录。

<div style="display: none;" id="div1" class="drop-down-show-hide">
          <table id="myTable" class="table table-striped">
            <thead>
              <tr>
                <th>Service Name</th>
                <th>Type</th>
                <th></th>
                <th></th>

              </tr>
            </thead>
            <tbody>
              <tr>
                <td>ADA/FEHA Compliance</td>
                <td>Best Practice</td>
                <td> <img src="img/note.png" alt="note"/></td>
                <td> <img src="img/del.png" alt="edit" /></td>
              </tr>
              <tr>
                <td>Asbestos Training (AHERA ...</td>
                <td>Mandatory</td>
                <td> <img src="img/note.png" alt="note"/></td>
                <td> <img src="img/del.png" alt="edit" /></td>

              </tr>
             </tbody>
          </table>
          </div>

here is my java scripts code 这是我的Java脚本代码

<script>
$(document).ready(function(){
    $('#myTable').dataTable();
});
</script>

Thanks!!! 谢谢!!!

You can enable paging and dynamic page size with the following code 您可以使用以下代码启用分页和动态页面大小

$(document).ready(function() {
    $('#example').dataTable( {
        "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
    } );
} );

More info can be found here 更多信息可以在这里找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM