Javascript 动态表JQuery编辑

Javascript 动态表JQuery编辑,javascript,jquery,html,dynamic-tables,Javascript,Jquery,Html,Dynamic Tables,我对JQuery完全是新手,但我需要有人帮我完成这部分。 我正在处理来自模板的动态表。我希望删除每页10条记录,但我不知道如何删除。有人吗 这是我仍然可以理解的HTML代码 <table class="table table-striped border-top" id="sample_1"> <thead> <tr> <!-- <th style="width:8px;"><

我对JQuery完全是新手,但我需要有人帮我完成这部分。 我正在处理来自模板的动态表。我希望删除每页10条记录,但我不知道如何删除。有人吗

这是我仍然可以理解的HTML代码

<table class="table table-striped border-top" id="sample_1">
        <thead>
          <tr>
            <!-- <th style="width:8px;"><input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes" /></th> -->
            <th>No</th>
            <th>Name</th>
            <th class="hidden-phone">Name</th>
            <th class="hidden-phone">Text</th>
            <th class="hidden-phone">Text</th>
            <th class="hidden-phone">Text</th>
          </tr>
        </thead>
        <tbody>
          <tr class="odd gradeX">
            <!-- <td><input type="checkbox" class="checkboxes" value="1" /></td> -->
            <td>1</td>
            <td>Jhone doe</td>
            <td class="hidden-phone"><a href="mailto:jhone-doe@gmail.com">jhone-doe@gmail.com</a></td>
            <td class="hidden-phone">10</td>
            <td class="center hidden-phone">02.03.2013</td>
            <td class="hidden-phone"><span class="label label-success">Approved</span></td>
          </tr>
          <tr class="odd gradeX">
            <!-- <td><input type="checkbox" class="checkboxes" value="1" /></td> -->
            <td>2</td>
            <td>dipsdf</td>
            <td class="hidden-phone"><a href="mailto:soa bal@gmail.com">lorem-ip@gmail.com</a></td>
            <td class="hidden-phone">33</td>
            <td class="center hidden-phone">05.04.2013</td>
            <td class="hidden-phone"><span class="label label-success">Approved</span></td>
          </tr>
        </tbody>
      </table>
Jquery部分,我不知道它在那里做什么

var Script = function () {

    // begin first table
    $('#sample_1').dataTable({
        "sDom": "<'row'<'col-sm-6'l><'col-sm-6'f>r>t<'row'<'col-sm-6'i><'col-sm-6'p>>",
        "sPaginationType": "bootstrap",
        "oLanguage": {
            "sLengthMenu": "_MENU_ records per page",
            "oPaginate": {
                "sPrevious": "Prev",
                "sNext": "Next"
            }
        },
        "aoColumnDefs": [{
            'bSortable': false,
            'aTargets': [0]
        }]
    });

    jQuery('#sample_1 .group-checkable').change(function () {
        var set = jQuery(this).attr("data-set");
        var checked = jQuery(this).is(":checked");
        jQuery(set).each(function () {
            if (checked) {
                $(this).attr("checked", true);
            } else {
                $(this).attr("checked", false);
            }
        });
        jQuery.uniform.update(set);
    });

    jQuery('#sample_1_wrapper .dataTables_filter input').addClass("form-control"); // modify table search input
    jQuery('#sample_1_wrapper .dataTables_length select').addClass("form-control"); // modify table per page dropdown}();
我试图将表与数据库中的显示数据链接起来,同时用添加按钮替换每页10条记录。任何人都可以


谢谢

如果您只是想一次列出所有记录,并隐藏更改每页数字显示的选项,则必须禁用分页

将以下选项添加到datatables调用中

"bPaginate": false
阅读有关Datatable选项的更多信息

编辑

如果仍要分页,但仅隐藏每页选项,请使用以下选项

"bLengthChange": false

谢谢你的信息。最终,它也删除了底部页码=知道如何删除顶部1而不是同时删除两个吗???@CarsonLee我已经更新了我的答案,请查看并让我知道它是否有帮助。完美匹配bro=D,但我想知道如何将按钮添加到它中,使其非常适合?因为我真的找不到CSS来把按钮放在像bLengthChange这样好的地方。@CarsonLee抱歉,我不确定我是否理解正确。你想在下拉列表的位置设置一个按钮吗?