{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'
		}
	]
});

相关

以下选项直接相关,在您的应用程序开发中也可能有用。