{hero}

tables().header()

自:DataTables 1.10 起

取得 API 環境中表格的 thead 節點。

說明

DataTables 及其外掛程式可以在文件中建立額外的表格。例如,當啟用捲動時,表格會分割成三個獨立的表格:表頭、表尾和表身,以提供跨瀏覽器的捲動效果,而 FixedHeader / FixedColumns 則會建立複製的表格以進行靜態定位。

此方法及其單數對應方法旨在提供對原始 thead 元素的輕鬆存取,以便進行 DOM 操作。

類型

function tables().header()

說明

取得 thead 節點

回傳

DataTables API 實例,其中包含結果集中所選表格的表頭節點。

範例

將類別新增至原始 thead 元素

var tables = new DataTable('.dataTable', {
	scrollX: '100%'
});

tables
	.tables()
	.header()
	.to$()
	.addClass('highlight');

相關

以下選項直接相關,在您的應用程式開發中也可能很有用。