Search code examples
datatabledatatablesscrollbardatatables-1.10perfect-scrollbar

Can we apply SlimScroll or PerfectScrollbar plugin to jQuery Datatable default vertical scroll


I am using Datatable ver 1.10, I enable the vertical scrolling. now datatable showing window default scroll style.

Is it possible to change/implement some other scrollBar on datatable scrollbar? to make it more beautiful and fancy.

enter image description here

I tried this solution at stackoverflow but it squeez the header. also I want header and footer fixed position.


Solution

  • here is my working code

    // when initialization is completed then apply scroll plugin
    "fnInitComplete":function(){
        $('.dataTables_scrollBody').perfectScrollbar();
    },
    
    //apply scroll on this height
    "scrollY": 450,
    
    //on paginition page 2,3.. often scroll shown, so reset it and assign it again 
    "fnDrawCallback": function( oSettings ) {
        $('.dataTables_scrollBody').perfectScrollbar('destroy').perfectScrollbar();
    },