Javascript 如何在DIV元素中定位数据表
我正在使用下面的代码在运行时使用引导和datatable插件生成一个表。数据表是按预期创建的,但是我无法将此表定位在div中并控制分页 有人能帮我更正代码,以便创建与div元素相关的数据表吗Javascript 如何在DIV元素中定位数据表,javascript,jquery,html,css,datatables,Javascript,Jquery,Html,Css,Datatables,我正在使用下面的代码在运行时使用引导和datatable插件生成一个表。数据表是按预期创建的,但是我无法将此表定位在div中并控制分页 有人能帮我更正代码,以便创建与div元素相关的数据表吗 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html> <html> <head> <
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="${pageContext.request.contextPath}/resources/js/jquery-
3.1.1.min.js"></script>
<link href="${pageContext.request.contextPath}/resources/jTable/media /css/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/resources/jTable/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="${pageContext.request.contextPath}/resources/jTable/media/js/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/resources/jTable/media/js/dataTables.bootstrap.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/resources/js/javascript.js" type="text/javascript"></script>
$(文档).ready(函数(){
$('tblorderbody').DataTable();
} );
病例ID
情景类型
订单开始时间
过程模式
代理名称
评论
地位
displayTablebody();
首先-您不应该对和标记使用相同的ID。请出示displayTablebody函数代码。你能修改一下你的代码吗?你还可以给出一个屏幕截图,你的问题到底发生了什么?
<script type="text/javascript">
$(document).ready(function() {
$('#tblorderbody').DataTable();
} );
</script>
</head>
<body>
<div class="bodyContiner">
<div class="runStatus">
<table class="table table-striped table-bordered" style="cellspacing:0;display: block; position: relative;" id="tblorderbody">
<thead>
<tr>
<th style="width:10%;">CASE ID</th>
<th style="width:25%;">SCENARIO TYPE</th>
<th style="width:10%;">ORDER START TIME</th>
<th style="width:10%;">PROCESS MODE</th>
<th style="width:10%;">AGENT NAME</th>
<th style="width:30%;">COMMENTS</th>
<th style="width:5%;">STATUS</th>
</tr>
</thead>
<tbody id ="tblordertbody">
</tbody>
</table>
<script>displayTablebody();</script>
</div>
</div>
</body>
</html>