{hero}

row().child().hide()

自:DataTables 1.10

建立新的子行後,隱藏子行。

描述

此方法可用於隨時隱藏父行的子行。當子行設定為隱藏時,它們不會從父行中分離,而只是不會在頁面上繪製。此方法提供了一種在任何需要的時候隱藏行的方式。

請注意,此方法僅在調用 row().child() 並設定參數時可用。這是因為如果沒有參數調用 row().child(),將會傳回子行,它會是一個 jQuery 物件或 undefined。當使用參數調用時,row().child() 會傳回一個 DataTables.Api 實例。如果您需要隱藏沒有設定任何參數的子行,請使用 row().child.hide()

值得一提的是,此方法可能用途有限,但為了完整性,它被包含在 API 中!

與許多其他操作 DataTable 的方法不同,此方法不需要調用 draw() 來顯示結果更改。子行會插入到表格中,而無需 DataTables 重繪。

類型

函式 row().child().hide()

描述

隱藏父行的子行

傳回

DataTables API 實例。

範例

在設定子行的值後立即隱藏它

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

// Show an initial child row
table
	.row(':eq(0)')
	.child('Extra information...')
	.show();

// Change the information and hide - without the hide() call the changed
// information would be visible due to the show() above.
table
	.row(':eq(0)')
	.child('Different information')
	.hide();