DataTable rất hữu ích khi chúng ta cần đổ dữ liệu vào bảng. Dưới đây là những kinh nghiệm khi mình sử dụng.

B1: Import 2 link này vào tài liệu HTML của bạn (lưu ý: nên đặt ở cuối trước thẻ <body> để tránh ảnh hưởng các thư viện khác mà bạn sử dụng trong tài liệu HTML của bạn)
<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css"> <script type="text/javascript" src="http://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
B2: Ở phần table của bạn hãy tạo 1 id định danh cho table. Như ví dụ dưới mình đặt là example1
<table id="example1" class="table table-striped table-bordered">
B3: Chèn code javascript vào. Nhớ chỉnh lại định danh của table nhé.
<script type="text/javascript">
// Basic example
$(document).ready(function () {
$('#example1').DataTable();
});
</script>
Bạn thay đoạn code javascript ở B3 thành code dưới đây nhé. Nhớ chỉnh lại định danh của table.
<script type="text/javascript">
// Basic example
$(document).ready(function () {
$('#example1').DataTable({
searching: true,
paging: true,
ordering: true,
info: false,
language: {
lengthMenu: "Hiển thị _MENU_ bản ghi",
search: "Tìm kiếm ",
zeroRecords: "Không tìm thấy",
infoEmpty: "Không có bản ghi nào",
paginate: {
first: "Premier",
previous: "Trước",
next: "Sau",
last: "Dernier"
},
} // false to disable search (or any other option)
});
});
</script>