数据表服务器端处理微调器

时间:2019-11-11 20:13:58

标签: datatables

我正在使用大约有8k条记录的数据表。为了加快速度,我使用了服务器端处理。

我的问题是使用自定义过滤器后出现“正在加载”消息或微调框。

在下面的代码中,微调器在初始加载时按预期显示,但在将文本放入搜索框并按“应用”后,它没有出现。

  <script type="text/javascript">

  $(document).ready(function() {
      $('#publication_table').DataTable( {
        caseInsensitive: false,
        dom: 'lrtipB',
        processing: true,
        'language': {
            'loadingRecords': 'loading',
            'processing': '<div class="spinner"></div>'
        },
        serverSide: true,
        ajax: {
          url: "network_pub_output1.php",
          "type": "GET",
          "data": function(d) {
                 return $.extend( {}, d, {
                    "publication_table_col0_filter": $('#publication_table_col0_filter').val()
                  } );
          }
        },
        buttons: ['copy', 'excel'],
        scrollY:        "300px",
        scrollX:        true,
        scrollCollapse: true,
        paging:         false,
        fixedColumns:   {
            heightMatch: 'none'
        },
        "order": [[ 0, "desc" ]],
        columns: [
            { "orderSequence": [ "desc", "asc" ] }
        ]
      } );
  } );
  </script>

Here is a stripped-down example-那里没有大量数据,因此过滤非常快。但是,如果您在搜索中添加了一些内容,然后清除搜索并重新应用,那么您应该明白我的意思了。

0 个答案:

没有答案