JQuery Datatable sDom 配置

阅读更多

用过JQuery Datatable的人都知道,他很强大,也很简单,但是有一个属性的设定总是很模糊,他就是sDom.

 

官网给的描述是:

 

This initialisation variable allows you to specify exactly where in the DOM you want DataTables to inject the various controls it adds to the page (for example you might want the pagination controls at the top of the table). DIV elements (with or without a custom class) can also be added to aid styling. The follow syntax is used:

The following options are allowed:
'l' - Length changing
'f' - Filtering input
't' - The table!
'i' - Information
'p' - Pagination
'r' - pRocessing
The following constants are allowed:
'H' - jQueryUI theme "header" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')
'F' - jQueryUI theme "footer" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')
The following syntax is expected:
'<' and '>' - div elements
'<"class" and '>' - div with a class
'<"#id" and '>' - div with an ID

 

 

拿个例子来看:

 

"sDom": ">",

 分解一下就是:

<t<'span12 center'p>>

最后的HTML就是:

表格内容
分页栏

 页面显示如图:


JQuery Datatable sDom 配置_第1张图片
  

清楚了这个逻辑就感觉简单多了。

 

 

 

  • JQuery Datatable sDom 配置_第2张图片
  • 大小: 24.4 KB
  • 查看图片附件

你可能感兴趣的:(JQuery Datatable sDom 配置)