第二个网络请求后数据表未刷新 [英] Datatables not refreshing after second network request

查看:57
本文介绍了第二个网络请求后数据表未刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经这样定义了数据表:

I've defined my datatable like so:

$('div#accessorial-list-table table').dataTable({
        'bProcessing': true,
        'bServerSide': true,
        'bSort': true,
        'sAjaxSource': '/accessorials/fetch',
        'sPaginationType': 'full_numbers',
        "sDom": '<"top"<"clear">>r',
        'aaSorting': [[ 0, 'asc' ]],
        'iDisplayLength': 1000,
        'oLanguage': {
            'sInfoFiltered': '',
            'sProcessing': 'DOING THINGS',
            'sLengthMenu': '',
            'oPaginate': {
                'sPrevious': '',
                'sNext': '',
                'sFirst': '',
                'sLast': ''
            }
        },
        "aoColumns": [
            null,
            null,
            null,
            { 'sClass': 'align_center' },
            { 'sClass': 'align_center' },
            { 'sClass': 'align_center' },
            { 'sClass': 'align_center' }
        ]
    });

我的回答如下:

{
    "sEcho": true,
    "iTotalRecords": 97,
    "iTotalDisplayRecords": 97,
    "aaData": [bunch of data]
}

第一个提取工作正常,所有数据加载进入桌子。但是,当我尝试对任何列进行排序时,即使我在网络检查器中看到网络请求已成功完成,做的事情也不会消失。在Ajax中返回的数据两次都是正确的。

The first fetch works fine, and all of the data loads into the table. However, when I try to sort any of the columns, "DOING THINGS" never goes away even though I see the network request completed successfully in the network inspector. The data that comes back in Ajax is correct both times.

有人曾经看过它吗,或者知道我对数据表的定义是否错误?

Has anyone seen it do this before or know if my definition of datatables is wrong?

我已经通过jsonlint.com运行了响应,并且都是有效的JSON响应。

I've run the responses through jsonlint.com and both are valid JSON responses.

推荐答案


sEcho:是,

"sEcho": true,

在一天结束时,服务器需要返回什么数据表发送sEcho。

At the end of the day, the server needs to return what datatables sends in sEcho.

这篇关于第二个网络请求后数据表未刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆