JQuery Datatables Dom 和 Language 參數詳細說明


http://linleizi.iteye.com/blog/2086435

***********************************

 

Data Tables: http://datatables.net/

Version: 1.10.0

 

Dom說明

定義表格控件在頁面的顯示順序。

每個控件元素在數據表都有一個關聯的單個字母。

  • l - 每頁顯示行數的控件
  • f - 檢索條件的控件
  • t - 表格控件
  • i - 表信息總結的控件
  • p - 分頁控件
  • r - 處理中的控件

還可以在控件元素外添加DIV和Class,語法如下

  • < and > - DIV元素
  • <"class" and > - DIV和Class
  • <"#id" and > - DIV和ID

Language說明

數據表的文言設置。

參數文檔:

 

Js代碼   收藏代碼
  1. {  
  2.     "emptyTable":     "No data available in table",  
  3.     "info":           "Showing _START_ to _END_ of _TOTAL_ entries",  
  4.     "infoEmpty":      "Showing 0 to 0 of 0 entries",  
  5.     "infoFiltered":   "(filtered from _MAX_ total entries)",  
  6.     "infoPostFix":    "",  
  7.     "thousands":      ",",  
  8.     "lengthMenu":     "Show _MENU_ entries",  
  9.     "loadingRecords": "Loading...",  
  10.     "processing":     "Processing...",  
  11.     "search":         "Search:",  
  12.     "zeroRecords":    "No matching records found",  
  13.     "paginate": {  
  14.         "first":      "First",  
  15.         "last":       "Last",  
  16.         "next":       "Next",  
  17.         "previous":   "Previous"  
  18.     },  
  19.     "aria": {  
  20.         "sortAscending":  ": activate to sort column ascending",  
  21.         "sortDescending": ": activate to sort column descending"  
  22.     }  
  23. }  
 

 

 

 

 

Example:

  • 沒有檢索元素
Js代碼   收藏代碼
  1. /* Results in: 
  2.     <div class="wrapper"> 
  3.       {length} 
  4.       {processing} 
  5.       {table} 
  6.       {information} 
  7.       {pagination} 
  8.     </div> 
  9. */  
  10. $('#example').dataTable( {  
  11.   "dom": 'lrtip'  
  12. } );  

 

  • 簡單的DIV和樣式元素設置
Js代碼   收藏代碼
  1. /* Results in: 
  2.     <div class="wrapper"> 
  3.       {filter} 
  4.       {length} 
  5.       {information} 
  6.       {pagination} 
  7.       {table} 
  8.     </div> 
  9. */  
  10. $('#example').dataTable( {  
  11.   "dom": '<"wrapper"flipt>'  
  12. } );  
  •  每頁行數,檢索條件,分頁在表格上面,表信息在表格下面

 

Js代碼   收藏代碼
  1. /* Results in: 
  2.     <div> 
  3.       {length} 
  4.       {filter} 
  5.       <div> 
  6.         {table} 
  7.       </div> 
  8.       {information} 
  9.       {pagination} 
  10.     </div> 
  11. */  
  12. $('#example').dataTable( {  
  13.   "dom": '<lf<t>ip>'  
  14. } );  

 

  •  表信息在表上面,檢索條件,每頁行數,處理中在表下面,並且有清除元素

 

 

Js代碼   收藏代碼
  1. /* Results in: 
  2.     <div class="top"> 
  3.       {information} 
  4.     </div> 
  5.     {processing} 
  6.     {table} 
  7.     <div class="bottom"> 
  8.       {filter} 
  9.       {length} 
  10.       {pagination} 
  11.     </div> 
  12.     <div class="clear"></div> 
  13. */  
  14. $('#example').dataTable( {  
  15.   "dom": '<"top"i>rt<"bottom"flp><"clear">'  
  16. } );  

 

  • 實際應用

 

Js代碼   收藏代碼
  1. /**  

  <style>

  .float_left{

  float: left;

  }

  .float_right {

  float:right;

  }

  </style>

Js代碼   收藏代碼
  1. */  
  2.     $('#dealsData').dataTable(  
  3.         {  
  4.             'dom': '<"float_left"f>r<"float_right"l>tip',  
  5.             'language': {  
  6.                 'emptyTable': '沒有數據',  
  7.                 'loadingRecords': '加載中...',  
  8.                 'processing': '查詢中...',  
  9.                 'search': '檢索:',  
  10.                 'lengthMenu': '每頁 _MENU_ 件',  
  11.                 'zeroRecords': '沒有數據',  
  12.                 'paginate': {  
  13.                     'first':      '第一頁',  
  14.                     'last':       '最后一頁',  
  15.                     'next':       '',  
  16.                     'previous':   ''  
  17.                 },  
  18.                 'info': '第 _PAGE_ 頁 / 總 _PAGES_ 頁',  
  19.                 'infoEmpty': '沒有數據',  
  20.                 'infoFiltered': '(過濾總件數 _MAX_ 條)'  
  21.             }  
  22.         }  
  23.     );  
效果圖片

 

分享到:
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM