hanker

JavaScript - DataTables 사용법 본문

JavaScript

JavaScript - DataTables 사용법

hanker 2020. 8. 18. 11:26
반응형
<html>
<head>
	<meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Home</title>
	<link rel="stylesheet" href="https://cdn.datatables.net/t/bs-3.3.6/jqc-1.12.0,dt-1.10.11/datatables.min.css"/>
</head>
<body>
	<table id="boardTable" class="table table-bordered">
		<thead>
			<tr>
				<th>NO</th>
				<th>제목</th>
				<th>작성자</th>
				<th>조회수</th>
				<th>작성일</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
		</tbody>
	</table>
	 
    <script src="https://cdn.datatables.net/t/bs-3.3.6/jqc-1.12.0,dt-1.10.11/datatables.min.js"></script>
    <script>
    	$(function(){
    		$("#boardTable").DataTable();
    	});
    </script>
</body>

</html>

$("#테이블아이디).DataTable();

 - dataTables 기본설정

반응형