DataTables 詳細設定(1)
阿新 • • 發佈:2019-02-15
<script type="text/javascript">
$(document).ready(function() {
var table = $('#datatables').DataTable({
"autoWidth": false,
"paging": true,
//"dom": 'T<"clear"><"toolbar">Clfrtip',
"dom": 'iCflrtp',
"iDisplayLength": 100,
"lengthMenu": [[100, 500, 1000, -1], [100, 500, 1000, "所有"]],
"tableTools": {
"sSwfPath": "/js/datatables/tabletools/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{sExtends: "csv", oSelectorOpts: {page: "current" }},
"print"],
"sRowSelect": "os",
},
"stateSave": false,
"processing": true ,
"ajax": {
'url': "/test/index",
},
"order": [
[0, "asc"],
[1, "asc"],
[2, "desc"],
],
"columnDefs": [
{width: '25%', targets: 3},
],
"columns": [{
"data": "name",
}, {
"data": "age",
}, {
"data": "job",
}, {
"data": "description",
"visible":false
}],
"sPaginationType": "full_numbers",
"oLanguage": {
"sProcessing": "<img src='/images/datatable_loading.gif'> 努力載入資料中.",
"sLengthMenu": "每頁顯示 _MENU_ 條記錄",
"sZeroRecords": "抱歉, 沒有找到",
"sInfo": "從 _START_ 到 _END_ /共 _TOTAL_ 條資料",
"sInfoEmpty": "沒有資料",
"sInfoFiltered": "(從 _MAX_ 條資料中檢索)",
"sZeroRecords": "沒有檢索到資料",
"sSearch": "模糊查詢: ",
"oPaginate": {
"sFirst": "首頁",
"sPrevious": "前一頁",
"sNext": "後一頁",
"sLast": "尾頁"
}
},
});