Jquery DataTable 中的滚动问题 [英] Scroll issue in Jquery DataTable

查看:35
本文介绍了Jquery DataTable 中的滚动问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定我是否在重复这个问题,如果是的话,是正确的地方指南:)

I am not sure if I am repeating the question if yes guide to the right place :)

我正在使用数据表并尝试实现水平滚动并找到此链接

I am using Data table and trying to implement Horizontal Scrolling and found this link

http://www.datatables.net/examples/basic_init/scroll_x.html

我在数据表代码中使用了这些属性,但在 UI 中遇到了问题.

i used these properties in my Data Table code and am having issues in UI.

我的数据有水平滚动条,但我的列没有扩展,也没有按预期工作.我在正常列下方有额外的空列.

My data got the horizontal scroll bar but my columns didn't expand and not working as expected.i got additional empty column below my normal column.

基本上我的用户界面搞砸了.我看到了一个旧线程讨论!

Basically my UI is messed up. i saw a old thread discussion on the same!

DataTables 固定标题与宽表中的列不对齐

这些问题现在解决了吗?

Are these issues fixed now any solutions ?

================================

================================

添加示例代码

$("#results").dataTable({
    "aaData": [
        //My data
    ],
    "aoColumns": [
        //My Columns
    ],
    "bPaginate": true,
    "bSort": true,
    "bFilter": false,
    "bJQueryUI": false,
    "bProcessing": true,
    "sScrollX": "100%",
    "sScrollXInner": "110%",
    "bScrollCollapse": true
});

推荐答案

我遇到了类似的问题,但以不同的方式解决了.

I had a similar issue, but solved it in a different way.

我修改了 sDom 参数以将表格包装在额外的 div 中:

I modified the sDom parameter to wrap the table in an extra div:

sDom: 'r<"H"lf><"datatable-scroll"t><"F"ip>',

然后我将以下样式应用到 .datatable-scroll 类:

I then applied the following styles to the .datatable-scroll class:

/**
 * Makes the table have horizontal scroll bar if its too wide for its container
 */
.datatable-scroll {
    overflow-x: auto;
    overflow-y: visible;
}

http://datatables.net/usage/options#sDom

这篇关于Jquery DataTable 中的滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆