Datatables not refreshing after second network request

牧云@^-^@ 提交于 2020-01-15 09:13:08

问题


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' }
        ]
    });

And my responses look like this:

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

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?

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


回答1:


"sEcho": true,

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



来源:https://stackoverflow.com/questions/18191697/datatables-not-refreshing-after-second-network-request

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!