Cannot align the table when used together when I use fixedColumns and fnFooterCallback

Cannot align the table when used together when I use fixedColumns and fnFooterCallback

CMDcoderCMDcoder Posts: 2Questions: 1Answers: 0

    function buildFfmx(columnList) {
        // $("#left-container").width(window.innerWidth - 464);
        //dataTables
        $ffmxTable.empty().append(tfootStr);
        window.ffmxTable = $ffmxTable.DataTable({
            'createdRow': function (row, data, dataIndex) {
                // row id
                var $row = $(row);
                $row.addClass('dataTable-row-heigit100');
            },
            'processing': true,
            'serverSide': true,
            'sort': 'g.id desc',
            'ajax': {
                'url': CTX + '/gs/ffmx/datatables.json',
                'type': 'POST',
                'data': function (data) {
                    var pageRequest = $.x.getDatatablePageable(data);
                    return $.extend(pageRequest, queryParam());
                }
            },
            'columns': columnList,
            'columnDefs': [
                {'width': '100px', 'targets': '_all'},
                {'defaultContent': '', targets: '_all'}
            ],
            'pageLength': 100,
            'paginate': true,
            "scrollY": window.innerHeight - 485,
            'scrollCollapse': true,
            'scrollX': true,
            'bautowidth': true,
            "fixedColumns" : {
                'leftColumns' : 5
            }, 
            'fnFooterCallback': function(nRow, aaData, iStart, iEnd, aiDisplay) {
                var response = this.api().ajax.json().extraData;
                console.log(response);
                var api = this.api();
                $(api.column(0).footer()).html('合计:');
                $(api.column(3).footer()).html(parseFloat(response.yfje).toFixed(2));
                $(api.column(4).footer()).html(parseFloat(response.yksje).toFixed(2));
                $(api.column(5).footer()).html(parseFloat(response.sfje).toFixed(2));
                $(api.column(6).footer()).html(parseFloat(response.jssr).toFixed(2));
            },
        }).on('draw.dt', function () {  

        }); //oTable
    }

Answers

  • CMDcoderCMDcoder Posts: 2Questions: 1Answers: 0

    tfoot cannot be aligned

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.