cell().edit()
自:Editor 1.5.0 起
使用內嵌或泡泡編輯方式編輯儲存格。
請注意 - 此屬性需要 DataTables 的 Editor 擴充功能。
說明
此方法可用於使用 Editor 的內嵌或泡泡編輯模式編輯單個儲存格。它本質上是 inline()
或 bubble()
方法的代理,透過 DataTables API 物件公開,並使用 cell()
選擇器方便地選取要編輯的儲存格。
The Editor instance used by this method is the last Editor instance create that refers to this table when the table was constructed. This consideration is only important when using multiple Editor instances!
請注意,此方法僅透過 DataTables API 公開 Editor 的一小部分。Editor 有其自身的擴充 API,可完全控制表單。
類型
function cell().edit( [ type, ] options )
- 說明
使用 Editor 的內嵌或泡泡編輯方法編輯儲存格。
- 參數
名稱 類型 選填 1 options
是 - 預設值:inline 2 options
否 表單設定選項,包括設定表單標題、按鈕和行為的功能。
- 回傳
會傳回未修改的原始 API 實例,以允許鏈接。
範例
使用內嵌編輯方式編輯點擊的儲存格
var myTable = new DataTable('#myTable');
$('#myTable').on('click', 'tbody td', function () {
myTable.cell(this).edit();
});
使用泡泡編輯方式編輯點擊的儲存格
var myTable = new DataTable('#myTable');
$('#myTable').on('click', 'tbody td', function () {
myTable.cell(this).edit('bubble');
});
編輯儲存格,並在失去焦點時立即提交
var myTable = new DataTable('#myTable');
$('#myTable').on('click', 'tbody td', function () {
myTable.cell(this).edit({
blur: 'submit'
});
});
相關
以下選項直接相關,也可能對您的應用程式開發有所幫助。