colReorder.enable()
自:ColReorder 1.5.0 起
啟用或停用 ColReorder 的互動功能。
請注意 - 此屬性需要 DataTables 的 ColReorder 擴充功能。
描述
此方法可用於啟用和停用 ColReorder 與 DataTable 的終端使用者互動。 在最簡單的形式中,它可用於啟用 ColReorder,但它也可以使用可選參數來停用它。 這對於能夠使用三元運算子或某些外部變數來切換啟用狀態非常有用。
請注意,為了能夠啟用 ColReorder,必須在 DataTable 初始化中指定 colReorder
選項。如果未使用 colReorder
,則無法使用此方法啟用 ColReorder。
類型
範例
使用按鈕啟用/停用欄重新排序
var table = new DataTable('#myTable', {
colReorder: true
});
$('#enableReordering').on('click', function () {
table.colReorder.enable(true);
});
$('#disableReordering').on('click', function () {
table.colReorder.enable(false);
});
相關
以下選項直接相關,也可能在您的應用程式開發中很有用。