JQuery Datatables Dom 和 Language 参数详细说明

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说明

数据表的文言设置。

参数文档:

 

{
    "emptyTable":     "No data available in table",
    "info":           "Showing _START_ to _END_ of _TOTAL_ entries",
    "infoEmpty":      "Showing 0 to 0 of 0 entries",
    "infoFiltered":   "(filtered from _MAX_ total entries)",
    "infoPostFix":    "",
    "thousands":      ",",
    "lengthMenu":     "Show _MENU_ entries",
    "loadingRecords": "Loading...",
    "processing":     "Processing...",
    "search":         "Search:",
    "zeroRecords":    "No matching records found",
    "paginate": {
        "first":      "First",
        "last":       "Last",
        "next":       "Next",
        "previous":   "Previous"
    },
    "aria": {
        "sortAscending":  ": activate to sort column ascending",
        "sortDescending": ": activate to sort column descending"
    }
}
 

 

 

 

 

Example:

  • 没有检索元素
/* Results in:
    <div class="wrapper">
      {length}
      {processing}
      {table}
      {information}
      {pagination}
    </div>
*/
$('#example').dataTable( {
  "dom": 'lrtip'
} );

 

  • 简单的DIV和样式元素设置
/* Results in:
    <div class="wrapper">
      {filter}
      {length}
      {information}
      {pagination}
      {table}
    </div>
*/
$('#example').dataTable( {
  "dom": '<"wrapper"flipt>'
} );
  •  每页行数,检索条件,分页在表格上面,表信息在表格下面

 

/* Results in:
    <div>
      {length}
      {filter}
      <div>
        {table}
      </div>
      {information}
      {pagination}
    </div>
*/
$('#example').dataTable( {
  "dom": '<lf<t>ip>'
} );

 

  •  表信息在表上面,检索条件,每页行数,处理中在表下面,并且有清除元素

 

 

/* Results in:
    <div class="top">
      {information}
    </div>
    {processing}
    {table}
    <div class="bottom">
      {filter}
      {length}
      {pagination}
    </div>
    <div class="clear"></div>
*/
$('#example').dataTable( {
  "dom": '<"top"i>rt<"bottom"flp><"clear">'
} );

 

  • 实际应用

 

/**

  <style>

  .float_left{

  float: left;

  }

  .float_right {

  float:right;

  }

  </style>

*/
	$('#dealsData').dataTable(
		{
			'dom': '<"float_left"f>r<"float_right"l>tip',
	        'language': {
	        	'emptyTable': '没有数据',
	        	'loadingRecords': '加载中...',
	        	'processing': '查询中...',
	        	'search': '检索:',
	            'lengthMenu': '每页 _MENU_ 件',
	            'zeroRecords': '没有数据',
	            'paginate': {
	                'first':      '第一页',
	                'last':       '最后一页',
	                'next':       '',
	                'previous':   ''
	            },
	            'info': '第 _PAGE_ 页 / 总 _PAGES_ 页',
	            'infoEmpty': '没有数据',
	            'infoFiltered': '(过滤总件数 _MAX_ 条)'
	        }
		}
	);
效果图片

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值