{hero}

columns.footer

自:DataTables 2.0

設定欄位頁腳文字。

描述

columns.title 選項非常相似,但在這種情況下,它用於設定表格頁腳中顯示的文字。如果表格建構時頁腳不存在,並且此選項已針對表格中的欄位設定,則會自動建立頁腳的列和儲存格。

   DataTables will automatically wrap the column title in a `-tag span` element with a class of `dt-column-title`. This is done to ensure that the column title can be both read and written to, without interfering with other elements that might be in the column's footer cell.

    Please note that when constructing a footer, DataTables can only construct a simple footer with a single cell for each column. Complex footers with `colspan` and `rowspan` attributes must either already be defined in the document, or be constructed using standard DOM / jQuery methods. Furthermore, if you use this property with a multi-row footer in the DOM, the title will be set for the first row in the footer only.

請注意,此屬性會以 HTML 寫入表格的頁腳儲存格。因此,您可以在文字中包含 HTML,它將顯示為已渲染的 HTML,例如 input 元素是常見的用途。

類型

此選項可以給定的類型為

範例

設定欄位的標題和頁腳儲存格

new DataTable('#myTable', {
	columns: [
		{
			footer: 'First footer',
			title: 'First header'
		},
		{
			footer: 'Second footer',
			title: 'Second header'
		},
		{
			footer: 'Third footer',
			title: 'Third header'
		}
	]
});

相關

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