Slimscroll and jQuery Datatable

≡放荡痞女 提交于 2020-01-05 05:11:30

问题


Im trying to do mix them. use a slimlcroll with jQuery DataTable (no pagination). So, I found these examples:

Nice simple use of slimscroll

Nice Table

Now I tried to make the content of the table use slim scroll but it just doesnt work :(

what I tried is to put a div serrounding the tbody - and slimscoll that div:

<div id="slimtest1">     
<tbody>
    ...
</tbody>
</div>

http://jsfiddle.net/yossico/hxkvfs60/2/

I also try to slim scroll the tbody directly: http://jsfiddle.net/yossico/hxkvfs60/3/

<tbody id="slimtest1">
...
</tbody>

What I want is to scroll the table body via slimscroll and not with the default scrollbar. None of this worked - can someone please show me the light?

Thanks :)


回答1:


Check the Updated JSFiddle :- JSFiddle

   <table id="example" class="display" cellspacing="0" width="100%">
       ....
       <tbody id="slimtest1">
          ......
       </tbody>
   </table>

CSS

thead, tbody { display: block; }

tbody {
   height: 200px;       /* For the demo  */
   overflow-y: auto;    /* Vertical scroll    */
   overflow-x: hidden;  /* Hide the horizontal scroll */
}


来源:https://stackoverflow.com/questions/26969036/slimscroll-and-jquery-datatable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!