Customize fixedcolumns for different tables

Customize fixedcolumns for different tables

A166617A166617 Posts: 2Questions: 1Answers: 0

Hi All,
I have 5-6 tables in a page and i want different columns to be fixed in those columns as per customer needs. As per fixedcolumns.js, if i use the below function, i can only fix the first left 2 columns. This will remain same in all the tables.

new $.fn.dataTable.FixedColumns(table, {
leftColumns: 2,
rightColumns: 0
});

My question is, how can i customize this. for e.g. i want to make first left column fixed in table 1 and last 2 columns fixed in table 2. How can i seperate these. I wil be glad if someone could help me here.

regards,
Sonia

Answers

  • A166617A166617 Posts: 2Questions: 1Answers: 0

    I got it. All we have to do is, give an id to each table. For eg, my first table has id of 'table1'. i need to mention it in the script. Similarly, for other tables, specify id to it and add these script and customize accordingly. hope it helps someone too.

    var table1 = $('#table1').DataTable( {
    scrollY: "500px",
    scrollX: true,
    scrollCollapse: true,
    paging: false,
    searching: false,
    ordering: false,
    info: false,
    jQueryUI: true,
    sort: false,
    language: {"decimal":".", "thousands":","}
    });
    new $.fn.dataTable.FixedColumns( table1, {
    leftColumns: 2,
    rightColumns: 0
    } );

This discussion has been closed.