Scroller and fixed columns together

Scroller and fixed columns together

gabrielepalagabrielepala Posts: 1Questions: 1Answers: 0
edited September 2014 in Free community support

Hello! Did anybody use scroller extension together with fixed columns one?
When trying to apply both extensions, only the header has fixed columns, while the body doesn't.
What am I doing wrong?
I want a simple table with 40 columns (10 fixed) and 20000 rows.
Here is my code:

$(document).ready(function () {
var data = [];
for (var i = 0 ; i < 20000 ; i++) {
data.push([i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8, i + 9, i + 10, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i]);
}
var oTable = $('#example').dataTable({
data: data,
deferRender: true,
dom: "frtiS",
scrollY: 1000,
scrollX: true,
scrollCollapse: true
});
new $.fn.dataTable.FixedColumns(oTable, {
leftColumns: 10
});
});

Answers

  • GeneraleGenerale Posts: 4Questions: 1Answers: 0

    Hello! Have same problem.
    When removing: dom: "frtiS", Fixed columns works correctly, but Scroller turns off.

  • GeneraleGenerale Posts: 4Questions: 1Answers: 0

    Can someone give any advice? Will be really appreciate for any help. I learn coding for about 2 weeks, and sometimes it blows my brain!!!
    Datatables initialisation code. Probably, problem somewhere here.

        
            $(document).ready(function() {
             var table = $('#example').dataTable( {
                    "scrollX":    true,
                    "sScrollX": "100%",
                    "sScrollXInner": "120%",
                    "sPaginationType": "bootstrap",
                    "columns": [
                        { "width": "3%" },
                        { "width": "2%" },
                        null,
                        null,
                        { "width": "3%" },
                    { "width": "5%" }
                    ],
                    "processing": true,
                    "serverSide": true,
                    "ajax": "server_processing.php",
                deferRender:    true,
                dom:            "frtiS",
                scrollY:        $(document).height() - 630,
                    scrollCollapse: true,
                } );
            new $.fn.dataTable.FixedColumns( table, {
                leftColumns: 1,
                rightColumns: 1,
            } );
        } );
        
    
This discussion has been closed.