列到数据表中的行

时间:2018-05-28 12:30:41

标签: javascript jquery database datatable

我使用laravel和DataTable

laravel back data

enter image description here

我需要显示类似这样的数据

enter image description here

我设法不复制这些行,但我不知道如何动态更改标题并将数据从列传输到它

我的尝试

                    table = $('#table').DataTable({
                        processing: true,
                        serverSide: true,
                        iDisplayLength: 50,
                        bStateSave: true,
                        order: [[1, "desc"]],
                        dom:
                        "<'row'<'col-sm-4'l><'col-sm-2'B><'col-sm-6'f>>" +
                        "<'row'<'col-sm-12'tr>>" +
                        "<'row'<'col-sm-5'i><'col-sm-7'p>>",
                        renderer: 'bootstrap',

                        rowsGroup: [// Always the array (!) of the column-selectors in specified order to which rows groupping is applied
                            // (column-selector could be any of specified in https://datatables.net/reference/type/column-selector)

                            'id:name'
                        ],

                        ajax: {
                            url: "{{url('api/get-data')}}",
                            type: 'POST',

                            "data": function (d) {
...
                            }
                        },
                        autoFill: true,
                        columns: [
                            {data: 'id', name: 'id'},
                            {data: 'count_1', name: 'count_1'},
                            {data: 'count_2', name: 'count_2'}
                        ],

});

结果

enter image description here

0 个答案:

没有答案