数据表编辑器pagingType无法正常工作

时间:2018-03-27 18:42:42

标签: javascript jquery-datatables-editor

以下是与#results表相关的所有代码:

jQuery(document).ready(function) {
editor = new jQuery.fn.dataTable.Editor( {
    ajax: "<?php echo $full_dir . '/ajax_call.php'; ?>",
    table: "#results",
    fields: [ {
            label: "Mfg ID",
            name:  "ball_mfg.mfgID"
        }, {
            label: "Mfg name:",
            name:  "ball_mfg.name"
        }, {
            label: "Model #",
            name:  "ball_model.modelID"
        }, {
            label: "Model Name:",
            name:  "ball_model.name"
        }
    ]
} );

jQuery('#results').DataTable( {
    "pagingType": "full_numbers",
    dom: "Bfrtip",
    ajax: {
        url: "<?php echo $full_dir . '/ajax_call.php'; ?>",
        type: 'POST'
    },
    columns: [
        { "render": function ( data, type, full, meta ) {
            return '<input type="radio" name="select_model" class="radio1 my_input" data-modelID="'+full.ball_model.modelID+'">';
        }},  // here's a radio button, modify to use data to populate it,
        { data: "ball_mfg.name" },
        { data: "ball_model.name" }
    ],
    select: false,
    buttons: [
    ]
} );

这仅显示标准的上一页,页码和下一页按钮。您可以在https://www.bowling-tracker.com/bowl/bowling-resources/bowling-ball-information

查看输出

我的偏好实际上是有一个输入框。你会注意到我有

<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.16/pagination/input.js"></script>
标题中的

我尝试过使用     “pagingType”:“输入”,

但是我使用哪种分页类型似乎并不重要,它根本不会改变分页按钮。

我正在使用DataTables Editor来生成它,因为它需要在服务器端运行(由于返回的结果),因此我只能显示几个表(已连接)。

1 个答案:

答案 0 :(得分:0)

查看加载的source code。没有"pagingType"。将其更改为input,以便我们可以在输出正确时看到输出。