数据不会在数据表显示 [英] Data does not show in dataTables

查看:93
本文介绍了数据不会在数据表显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有错误,但没有数据。有没有我需要添加,使这项工作的选择吗?我的数据使用来自Ajax调用的结果。

No error but no data. Is there an option I need to add to make this work? my data uses the result from an ajax call.

有什么建议?

code:

    $.ajax({
        cache: false,
        url: "http://a.co.nz/GetTestDocs",
        data: '{'
          + '   "oldCompanyIdString": "' + selectOldCompanyId + '", '            
         + '    "effectiveDateString": "' + selectEffectiveDate + '", '
         + '    "endDateString": "' + selectEndDate + '",'
         + '   "userToken": "' + userToken + '"'
         + ' }',
        type: "POST",
        //jsonpCallback: "Value",
        contentType: "application/json",
        dataType: "json",
        error: function (jqXHR, textStatus, errprThrown) {
            //console.log(errprThrown);
            //window.location = location;
        },
        success: function (value) {
            if (value.GetTestDocsResult != null) {
                result = $.parseJSON(value.GetTestDocsResult);
                if (result.length == 0) {
                    alert("Your query did not return any data.");
                }
                else {
                    console.log(result);
                    bindDataTable(result.DocsList);                   
                }
            }
        }
    });

    function bindDataTable(data) {
    $('#docuList').dataTable({
        "processing": true,
        "ajax": data,
        "columns": [
            { "data": "Description" },
            { "data": "FileLocation" }]

    });
}

帮助pls..my首次使用数据表

Help pls..my first time to use dataTables

推荐答案

替换AJAX:数据,内容:数据,

function bindDataTable(data) {
    $('#docuList').dataTable({
        "processing": true,
        "data": data,
        "columns": [
            { "data": "Description" },
            { "data": "FileLocation" }
        ]
    });
}

这篇关于数据不会在数据表显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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