link我自己的show entries box to the data-table

link my own show entries box to the data-table

我创建了一个显示条目框,但我不知道如何 link 它到数据 table 所以它呈现 selected 的数字。我这样做是为了使用 css 和 js 来修复盒子的位置,阅读他们的文档对我帮助不大。谢谢你。 这是我的 select 盒子代码:

我试过: .pageLength .lengthMenu 脚本中的 .plengthMenu

<div class="fixedd" style="color: azure">
Show Entries: &nbsp;<select name="showentries" type="select" 
id="showentries" placeholder="Search...." style="        color: black">
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>

and this is my script:

 $(document).ready(function () {
        var dataTable = $('#scrape').dataTable({
            "pageLength": 100,
            "bLengthChange": false,
        });

        $("#searchbox").keyup(function () {
            dataTable.fnFilter(this.value);
        });
         $("#showentries").keyup(function () {
            datatable.lengthMenu(this.value);
        });


    });

顺便说一句,搜索框工作正常。

这就是我为让它发挥作用所做的工作。但是它只适用于 IE,如果有人知道如何让它在 chrome 上工作,请随时发表评论或添加答案。

<div class=" fixedd" style="color: azure">
        Show Entries: &nbsp;<select name="showentries" type="select" id="showentries" placeholder="Search...." style="color: black">
            <option id="_10" value="10">10</option>
            <option id="_25" value="25">25</option>
            <option id="_50" value="50">50</option>
            <option id="_100" value="100">100</option>

        </select>
    </div>
<script>
  $(document).ready(function () {
            var dataTable = $('#scrape').dataTable({
               // "pageLength": 100,
                "bLengthChange": false,
                   fixedHeader: {
                    header: true,
                    footer: true,
                    headerOffset: 50
                },
            });
            var table = $('#scrape').DataTable();

            $("#searchbox").keyup(function () {
                dataTable.fnFilter(this.value);
            });
           //'.btn-details',
            $("#scrape").on('click', function () {
                table.page.len(10).draw();
            });
            $("#scrape").on('click', function () {
                table.page.len(25).draw();
            });
            $("#scrape").on('click', function () {
                table.page.len(50).draw();
            });
            $("#scrape").on('click', function () {
                table.page.len(100).draw();
            });
        });
</script>