DataTables.Settings
≡ 显示网站导航
DataTables 设置对象。
描述
DataTables 通过一个设置对象存储每张表格的配置信息和数据。此对象的结构在 DataTables API 中被认为是私有的,而不支持读取或写入对象中的值。对象中包含的属性名称和值可以在版本之间改变并且确实存在改变!
1var
api =
new
$.fn.dataTable.Api( settings );
根据以上警告,您可能完全被这个对象吓跑,但实际上它非常有用。因为它包含描述一个 DataTable 所需的信息,所以 DataTables 通常会将此对象传递给回调方法来描述相关表格,然后可将该对象与 API 构造函数配合使用(请参阅 DataTables.Api
)为该表格创建一个新的 API 对象。例如
上述内容将为相关settings
对象引用到的表格创建一个 API 实例。
123456789new
DataTable(
'#myTable'
, {
"drawCallback"
:
function
( settings ) {
var
api =
new
$.fn.dataTable.Api( settings );
// Output the data for the visible rows to the browser's console
// You might do something more useful with it!
console.log( api.rows( {page:'current'} ).data() );
}
} );
Post new comment
Contributions in the form of tips, code snippets and suggestions for the above material are very welcome. To post a comment, please use the form below. Text is formatted by Markdown.
To post comments, please sign in to your DataTables account, or register:
Any questions posted here will be deleted without being published.
Please post questions in the Forums. Comments are moderated.