{hero}

row().child.show()

自 DataTables 1.10 起

使父列的子列顯示。

說明

此方法可以用於隨時顯示父列的子列。子列可以使用 row().child() 附加,但不一定要立即顯示。此方法提供了顯示已經附加的子列的選項。

與許多其他操作 DataTable 的方法不同,此方法不需要呼叫 draw() 即可顯示結果變更。子列會插入到表格中,而不需要 DataTables 重新繪製。

類型

function row().child.show()

說明

顯示父列的子列

回傳值

DataTables API 實例。

範例

初始建立詳細資料列,但在點擊列之前不顯示它們

var table = new DataTable('#myTable');

table.rows().every(function () {
	this.child('Row details for row: ' + this.index());
});

$('#example tbody').on('click', 'tr', function () {
	var child = table.row(this).child;

	if (child.isShown()) {
		child.hide();
	}
	else {
		child.show();
	}
});