javascript - 数据表 : disable first next previous last and show/search record when processing

标签 javascript datatables

我正在使用 Datatables 1.9 版本

var oTable = $('#example').dataTable( {
        "oLanguage": {"sSearch": "Search all columns:",
                      "sLengthMenu": "Display <select><option value='100'>100</option><option value='200'>200</option></select> records per page"
                     },
        "sPaginationType": "full_numbers",
        "bAutoWidth": false,
        "iDisplayStart": 0,
        "iDisplayLength": 2000,
        "bFilter": true,
        "bInfo": true,
        "bSort": true,
        "sScrollX": "100%",
        "sScrollY": "500px",
        "bScrollCollapse": true,
        "bPaginate": true,
        "bSortClasses": true,
        "bLengthChange": true,
        "bProcessing": true,
        "bDestroy": true,
        "bServerSide": true,
        "bDeferRender": true,
        "fnServerParams": function ( aoData ) {
                aoData.push( { "name": "form_data", "value": data } );
        },
        "sAjaxSource": "search.py",
        "fnServerData": function ( sSource, aoData, fnCallback ) {
                $.ajax( {
                                "dataType": 'json',
                                "type": "POST",
                                "url": sSource,
                                "data": aoData,
                                "success": function (json)
                                {
                                        fnCallback(json);
                                        $('html, body').animate({scrollTop:$(document).height()}, 'slow');
                                        document.getElementById("bottom").focus();
                                },
                                "error": function (xhr, error, thrown) {
                                        alert("An Error Occurred.!");
                                }
                });

问题是,当我运行搜索并且数据表呈现“正在处理...”文本时,“显示...搜索”和第一个下一个上一个和最后一个按钮也会显示。当数据表已处理或收到来自后端的响应时,有没有一种方法可以延迟显示。

最佳答案

您应该将 "bPaginate": false, 包含到传递给构造函数参数的配置对象中。

如图所示 here . 因为是数据表

关于javascript - 数据表 : disable first next previous last and show/search record when processing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10911122/

相关文章:

javascript - Mongoose 上的 Post 请求与 Get 请求不匹配

javascript - React/Flux 和 xhr/路由/缓存

jquery - 更改条目后数据表排序错误

javascript - jquery datatable 使用表单编辑表格行数据

javascript - 如何在 Thymeleaf 中使用 DataTable?

javascript - 使用 JavaScript 从选择标签获取数据

javascript - Cosmos DB 存储过程中的读取操作是否对数据采取排他锁?

javascript - 编译 Typescript 而不丢失 node_modules 路径?

jquery - 如何手动定义数据表服务器端排序?

php - jQuery DataTables 服务器端处理脚本连接表