concatenat data tables coums

巧了我就是萌 提交于 2019-12-13 08:25:13

问题


i try to create table through jquery now i successfully display table and data

if (re.length > 0) {
    $("#services_schdulue").append
    $('#services_schdulue thead').append(
        "<tr><th>Conactenate</th><th>frequency</th><th>FDuration</th><th>FMileage</th><th>Lperformed</th><th>Nddatetime</th><th>Ndmileage</th><th>Rfrequ</th><th>Rduration</th><th>RMileage</th></tr>"
    );

    for (var i = 0; i < re.length; i++) {
        if (re[i] !== null) {
            $('#services_schdulue tbody').append(
                '<tr><td>' + con  +
                '</td><td>' + re[i][0] +
                '</td><td>' + re[i][1] +
                '</td><td>' + re[i][2] +
                '</td><td>' + re[i][3] +
                '</td><td>' + re[i][4] +
                '</td><td>' + re[i][5] +
                '</td><td>' + re[i][6] +
                '</td><td>' + re[i][7] +
                '</td><td>' + re[i][8] +
                '</td><</tr>');
        }
    }
}

var myTable = $('#services_schdulue').DataTable();

I try to to concatenate like this

var con = re[i][0].concat(re[i][1], re[i][2]);

but this show wrong result this show result like this:

First column should be 6 month(s) 1000.

How to do that?


回答1:


You need to use colspan property of the datatable:

For Demo :

http://jsfiddle.net/dipakthoke07/sgyzfw79/1/

Stack overflow : DataTables - Not working when added colspan for the last column

Datable official:

https://datatables.net/examples/basic_init/complex_header.html



来源:https://stackoverflow.com/questions/40042969/concatenat-data-tables-coums

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