串联数据表coums [英] concatenat data tables coums

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

问题描述

我尝试通过jquery创建表,现在我成功显示表和数据

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();

我尝试连接这样

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

但这显示错误的结果,这样显示结果如下:

but this show wrong result this show result like this:

第一列应为6个月1000。

First column should be 6 month(s) 1000.

如何做?

推荐答案

使用datatable的colspan属性:

You need to use colspan property of the datatable:

对于演示:

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

overflow:
数据表 - 添加时不起作用colspan最后一列

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

Datable官方:

Datable official:

https://datatables.net/exam ples / basic_init / complex_header.html

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

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