javascript - DataTables scrollX 似乎不起作用
问题描述
我看过其他关于此的帖子,但我看到的解决方案似乎不起作用。
我正在使用垂直滚动(工作正常),但水平滚动不太好。
这是我的html:
<!DOCTYPE html>
<title>• 18464</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/ju-1.12.1/jq-3.3.1/jszip-2.5.0/dt-1.10.23/b-1.6.5/b-html5-1.6.5/fc-3.3.2/fh-3.1.8/rg-1.1.2/sc-2.0.3/sp-1.2.2/sl-1.3.1/datatables.min.css"/>
<link rel="stylesheet" href="css/w3.css" />
<script src="https://cdn.datatables.net/v/ju-1.12.1/jq-3.3.1/jszip-2.5.0/dt-1.10.23/b-1.6.5/b-html5-1.6.5/fc-3.3.2/fh-3.1.8/rg-1.1.2/sc-2.0.3/sp-1.2.2/sl-1.3.1/datatables.min.js"></script>
<script src="js/project.js"></script>
<script src="js/dt.js"></script>
</head>
<body>
<div style="width: 100%">
<h2 style="text-align: center">18464-PID -</h2>
<table style="width: 100%">
<tr>
<td >
<table>
<thead>
<tr>
<th>BEGIN DATE</th>
<th>END DATE</th>
</tr>
</thead>
<tr>
<td>
<input type="text" id="beginDate">
</td>
<td>
<input type="text" id="endDate">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div class="table-responsive">
<table id="claims" style = "width: 100%" class="display nowrap" >
<thead>
<tr>
<th>ICN</th>
<th>PROVIDER #</th>
<th>PROVIDER NAME</th>
<th>PAC #</th>
<th>LINE #</th>
<th>DISPOSITION</th>
<th>PKG</th>
<th>SUBSCRIBER</th>
<th>RENDERING PROVIDER NAME</th>
<th>RENDERING PROVIDER NPI</th>
<th>RENDERING PIN</th>
<th>CHECK AMOUNT</th>
<th>LINE ALLOWED</th>
<th>PROVIDER LIABILITY</th>
<th>SUBSCRIBER LIABILITY</th>
</tr>
</thead>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
我的JavaScript:
$(document).ready(function () {
// loading this here avoids timing issues since the ready() ensures the DOM is loaded
let today = new Date();
let formattedDate = today.getMonth()+1 + "/" + today.getDate() + "/" + today.getFullYear();
$('#beginDate').val(formattedDate);
$('#endDate').val(formattedDate);
$('#claims').DataTable({
scrollX: true,
scrollY: '55vh',
paging: false,
ajax: {
url: "php/my.php",
dataSrc: ""
},
columns: [
{data: "ICN"},
{data: "PROVIDER_NUMBER"},
{data: "PROVIDER_NAME"},
{data: "IN_PAC_NUMBER"},
{data: "IN_LINE_NUMBER"},
{data: "IN_DISPOSITION"},
{data: "PACKAGE_CODE"},
{data: "SUBSCRIBER"},
{data: "RENDERING_PROVIDER_NAME"},
{data: "RENEDERING_PROVIDER_NPI"},
{data: "RENDERING_PROVIDER_PIN"},
{data: "IN_CHECK_AMT"},
{data: "IN_LINEALLOWED"},
{data: "IN_PVLIAB"},
{data: "IN_LINESUBLIAB"}
]
});
});
对于 jQuery 日期选择器:
$(function() {
$( "#beginDate").datepicker();
$( "#endDate").datepicker();
});
这一切都很好,但我看不到屏幕右侧的值。
我会发布一个示例,但数据都是机密的。
解决方案
推荐阅读
- npm - npm 从未指定的注册表下载附加文件
- python - 使用 beautifulsoup 从下拉菜单中抓取
- javascript - 为什么设置 this.setState 后 App.js 中的状态没有更新?
- php - 警告:require_once():打开流失败:没有这样的文件或目录
- firebase - FIrestore 数据模型和密码功能的安全规则
- javascript - Canvas js如何将数据从数据库推送到Yii2中的图表
- php - 试图在同一行中选择不同的和计数,它是一半的工作?
- javascript - 其他
在 Jquery 中使用动态元素的方法,在删除和添加特定元素时不会导致空行。(由我解决) - coq - 如何证明排序列表
- html - css 绝对定位元素与其溢出父元素重叠