狀態恢復
始於:StateRestore 1.0.0
一個分割按鈕,表示已儲存的狀態並提供其功能。
請注意 - 此屬性需要 DataTables 的 StateRestore 擴充功能。
說明
這被用作分割按鈕中的主要按鈕,它表示並提供已儲存狀態的功能。此按鈕的主要功能是將其表示的狀態載入表格中。這包括排序、搜尋以及某些擴充功能的狀態等資訊。
分割按鈕中還有 3 個次要按鈕 - updateState
、removeState
和 renameState
。它們的文件提供了關於其功能的更多詳細資訊。
此按鈕用於 StateRestore 擴充功能中。
除了為所有按鈕提供的標準設置(例如 text
)之外,此按鈕沒有任何其他可用的配置選項。可以使用 language.buttons.stateRestore
選項設定按鈕中使用的預設文字。
範例
狀態恢復按鈕修改操作
DataTable.ext.buttons.stateRestore.action = function (e, dt, node, config) {
e.stopPropagation();
config._stateRestore.load(config._stateRestore.s.identifier);
console.log('Loaded state ' + config._stateRestore.s.identifier);
};