datatable-bootstrap 基本配置
阿新 • • 發佈:2018-03-19
ajax AR solid font play eat ... left -type
- function doSearch() {
- if(dtable!=null){
- dtable.fnClearTable(0);
- dtable.fnDraw(); // 重新加載數據
- }else{
- dtable = $("#datatable_ajax").dataTable({ //<span style="font-family: Arial, Helvetica, sans-serif;">datatable_ajax表單的id</span>
- "oLanguage" : { // 漢化
- "sLengthMenu": "每頁顯示 _MENU_條",
- "sZeroRecords": "沒有找到符合條件的數據",
- "sProcessing": "加載中...",
- "sInfo": "當前第 _START_ - _END_ 條 共計 _TOTAL_ 條",
- "sInfoEmpty": "沒有記錄"
- "sInfoFiltered": "(從 _MAX_ 條記錄中過濾)",
- "sSearch": "搜索:",
- "oPaginate": {
- "sFirst": "首頁",
- "sPrevious": "前一頁",
- "sNext": "後一頁",
- "sLast"
- }
- },
- "bStateSave" : false,
- "bJQueryUI" : true,
- "bPaginate" : true,// 分頁按鈕
- "bFilter" : false,// 搜索欄
- "bLengthChange" : false,// 每行顯示記錄數
- "iDisplayLength" : 10,// 每頁顯示行數
- "bSort" : false,// 排序
- "bInfo" : true,// Showing 1 to 10 of 23 entries 總記錄數沒也顯示多少等信息
- "bWidth" : true,
- "bScrollCollapse" : true,
- "sPaginationType" : "full_numbers", // 分頁,一共兩種樣式 另一種為two_button // 是datatables默認
- "bProcessing" : true,
- "bServerSide" : true,
- "bDestroy" : true,
- "bSortCellsTop" : true,
- "sAjaxSource" :currprojectname +"/aa/list.do", //所要請求的接口地址
- "sScrollY": "100%",
- "fnInitComplete": function() {
- this.fnAdjustColumnSizing(true);
- },
- "fnServerParams" : function(aoData) { //查詢條件的接口拼接
- aoData.push({
- "name" : "aa",
- "value" : a
- });
- aoData.push({
- "name" : "cc",
- "value" : encodeURI($("#aaa").val())
- });
- },
- "aoColumns" : [
- {"mData" : "id"}, //表單的屬性,必須一一對應而且行數必須相同!!!
- {"mData" : "name"},
- {"mData" : "lal"},
- {"mData" : "dota2"},
- {"mData" : "games"},
- ],
datatable-bootstrap 基本配置