javascript – "JQuery DataTables" Merge Same Row Data "rowspan"-ThrowExceptions

Exception or error:

I’m new in jQuery. I want to rowspan the same data using jQuery in my case.
I want my table look like this

Here’s my code:


    url: baseUrl + "api_dashboard/get_invest",
    dataType: 'JSON',
    type: "GET",
    success: function (res) {
        $('#table-invest tbody').empty();
        $.each(data, function (key, val) {
            var html = "<tr>" +
                "<td>" + val.DATE_PAYMENT + "</td>" +
                "<td>" + val.TYPE + "</td>" +
                "<td align='right'>" + accounting.formatNumber(val.USD,2,".",",") + "</td>" +
                "<td align='right'>" + accounting.formatNumber(val.EUR,2,".",",") + "</td>" +
            $('#table-invest tbody').append(html)


        var total = "<tr style='background-color:#67a2d8;color: white'>" +
            "<td colspan='2' align='center'>TOTAL</td>" +
            "<td align='right'>" + accounting.formatNumber(res.OUT_TOTAL_SELURUH[0].TOTAL_SELURUH_USD,2,".",",") + "</td>" +
            "<td align='right'>" + accounting.formatNumber(res.OUT_TOTAL_SELURUH[0].TOTAL_SELURUH_EUR,2,".",",") + "</td>" +

        $('#table-invest tbody').append(total);


<div class="view-table" >
    <table id="table-invest" class="table table-bordered">
            <th style="background-color: #F4D35E" width="100%" colspan="8">PAYMENT - INVEST/OPERATION</th>
            <th style="background-color: #67a2d8">DATE</th>
            <th style="background: #67a2d8">TYPE OF PAYMENT</th>
            <th style="background: #67a2d8">USD</th>
            <th style="background: #67a2d8">EUR</th>

My table now look like this. Can anyone help me…

Thank’s before

How to solve:

Try this

use footer callback function

Leave a Reply

Your email address will not be published. Required fields are marked *