you_are_beautiful
you_are_beautiful
采纳率0%
2017-09-14 02:25 阅读 2.8k

jquery datatables插件 表格数据初始化时,数据加载两次

/** 表格的数据渲染 /
function drawTable(aa001, aa002, aa003) {
dataTable = $("#dataTable").DataTable({
"searching": false,
"ordering": false,
"destroy": true,
"lengthMenu": [ 10, 20, 25, 30 ],
"lengthChange": false,
"paging": true,
"ajax": {
"url":"
*",
"data": {"aa001": aa001, "aa002": aa002, "aa003": aa003}
},
"language": {
"emptyTable": "无相关数据!",
"info": "符合查询条件的数据共 TOTAL 条,当前第 STARTEND 条数据",
"infoEmpty": "当前显示0到0条,共0条记录",
"lengthMenu": "显示 MENU 条",
"loadingRecords": "加载中...",
"processing": "加载中...",
"zeroRecords": "未查询到相关数据!",
"paginate": {
"first": "首页",
"last": "尾页",
"next": "下一页",
"previous": "上一页"
}
},
"columns": [
{"class" : 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "ab301"},

{ "data": "ab303"},
{ "data": "ac201"},
{ "data": "bm001"},
{ "data": "bm004"},
{ "data": "afk02"},
{ "data": "dc236"},
{ "data": "area"}
]
});
}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • you_are_beautiful you_are_beautiful 2017-09-14 02:28

    /** 表格的数据渲染 /
    function drawTable(aa001, aa002, aa003) {
    dataTable = $("#dataTable").DataTable({
    "searching": false,
    "ordering": false,
    "destroy": true,
    "lengthMenu": [ 10, 20, 25, 30 ],
    "lengthChange": false,
    "paging": true,
    "ajax": {
    "url":"*",
    "data": {"aa001": aa001, "aa002": aa002, "aa003": aa003}
    },
    "language": {
    "emptyTable": "无相关数据!",
    "info": "符合查询条件的数据共 TOTAL 条,当前第 START 至 END 条数据",
    "infoEmpty": "当前显示0到0条,共0条记录",
    "lengthMenu": "显示 MENU 条",
    "loadingRecords": "加载中...",
    "processing": "加载中...",
    "zeroRecords": "未查询到相关数据!",
    "paginate": {
    "first": "首页",
    "last": "尾页",
    "next": "下一页",
    "previous": "上一页"
    }
    },
    "columns": [
    {"class" : 'details-control',
    "orderable": false,
    "data": null,
    "defaultContent": ''
    },
    { "data": function (data, type, full) {
    ********console.log(data);********
    return data.ab301;
    }},

            { "data": "ab303"},
            { "data": "ac201"},
            { "data": "bm001"},
            { "data": "bm004"},
            { "data": "afk02"},
            { "data": "dc236"},
            { "data": "area"}
        ]
    });
    

    }

    点赞 评论 复制链接分享
  • you_are_beautiful you_are_beautiful 2017-09-14 02:30

    在console.log(data)时,控制台出现两遍加载的数据。是什么原因呢。

    点赞 评论 复制链接分享
  • sunny_desmond carrykingdow 2017-09-14 09:03

    drawTable(aa001, aa002, aa003) 这个方法 你调用了几次?

    点赞 评论 复制链接分享

相关推荐