{hero}

搜尋

自:DataTables 2.0 起

全域搜尋輸入框。

說明

此功能會在 DataTable 旁邊顯示一個全域搜尋輸入框,讓終端使用者可以輸入簡單的文字搜尋詞。 搜尋行為可以使用 search 物件進行自訂。

可以使用 searching 選項,或將其從 layout 選項中排除(這是 DataTables 2 的首選方法)來完全停用 search 功能。

範例

使用預設佈局停用搜尋輸入框

new DataTable('#myTable', {
	layout: {
		topEnd: null
	}
});

在左上方顯示搜尋輸入框

new DataTable('#myTable', {
	layout: {
		topStart: 'search',
		topEnd: null
	}
});

顯示具有選項的搜尋輸入框

new DataTable('#myTable', {
	layout: {
		topEnd: {
			search: {
				placeholder: 'Search here...'
			}
		}
	}
});

相關

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