按鈕
自:按鈕 1.0.0
按鈕設定物件。
請注意 - 此屬性需要 DataTables 的 按鈕擴充功能。
描述
此屬性是功能屬性 buttons
的別名,可用於從頂層 DataTables 設定物件設定功能,而不是在 layout
選項中設定(請參閱以下範例)。這讓您可以使用字串而不是物件來使用該功能,但如果您使用該功能的多个實例,則會限制設定。請參閱 buttons
的文件,以了解完整的詳細資訊和適用於此選項的選項。
如果您使用的是沒有 layout
選項的 DataTables 1.x,請使用此屬性名稱,但請參閱 buttons
的文件,以了解完整的詳細資訊。
範例
使用預設值建立按鈕並透過 dom
插入
new DataTable('#myTable', {
layout: {
topStart: 'buttons'
},
buttons: true
});
使用按鈕的陣列設定建立按鈕並透過 dom
插入
new DataTable('#myTable', {
layout: {
topStart: 'buttons'
},
buttons: ['copy', 'csv', 'excel']
});
使用物件設定建立按鈕並透過 dom
插入
new DataTable('#myTable', {
layout: {
topStart: 'buttons'
},
buttons: {
name: 'primary',
buttons: ['copy', 'csv', 'excel']
}
});