4

In data-table plugin, while I'm re-sizing the any of column with large size(width), I want to save the width of column and enable the horizontal scroll only when width is bigger, than some value(this value defined by me).

Whereas now it is relatively adjusting other column with and fixed with in 100%.

Can some one help with this?

 // all task view table generation script
var allTaskTable;
allTaskTable = $('#AllTaskTable').dataTable({
    "fnDrawCallback": function (AllTaskSettings) {
        if (AllTaskSettings.aiDisplay.length == 0) {
            return;
        }
    }, "sPaginationType": "full_numbers",
    "sDom": 'Rlr<"tableContainer"t>ip',
    "aaSorting": [[9, "asc"]],//Default sorting is on column 9, desc
    "aoColumnDefs": [
        { "bSortable": false, "aTargets": [0, 1] }//Do not sort on column 0 and 1, which are the radio button and context menu
    ],
    "bRetrieve": true,
    "bDestroy": true,
    "bPaginate": true,  // this line of code for header freeze
    //"bFilter": true,
    //"sScrollY": "580",
    //"sScrollX": "100%",
    //"sScrollXInner": "100%",
    //"bScrollCollapse": true
    "autoWidth": false

});
Alex Kulinkovich
  • 4,408
  • 15
  • 46
  • 50
Krish
  • 489
  • 2
  • 8
  • 28

1 Answers1

0
"scrollY": "200px",
"scrollCollapse": true,

Link : https://datatables.net/examples/api/tabs_and_scrolling.html

Hope this is what you are looking for

super cool
  • 6,003
  • 2
  • 30
  • 63
  • Thanks, but scrollY will enable only horizontal scroll, actually after i applied fixed:layout style for my table it get enable horizontal scroll without affecting other column width. Now i will try to freeze the header using: "bFilter": true, "sScrollY": "580", //"sScrollX": "100%", //"sScrollXInner": "100%", //"bScrollCollapse": true "scrollY": "200px", "scrollCollapse": true, but here while iam re-sizing header the column is not align with header width, there is an miss match happening ? any solutions? – Krish Jul 14 '14 at 08:05
  • 1
    datatables are super sensitive need a closer look . sample fiddle is appreciated – super cool Jul 14 '14 at 09:34