{hero}

按鈕.按鈕.命名空間

自:按鈕 1.0.0 起

每個按鈕的唯一命名空間。
請注意 - 此屬性需要 DataTables 的 按鈕 擴充功能。

描述

此屬性是功能屬性 buttons.buttons.namespace 的別名,可用於從頂層 DataTables 配置物件配置功能,而不是在 layout 選項中(請參閱下面的範例)。這可讓您使用字串而不是物件來使用該功能,但如果您使用該功能的多個實例,它會限制配置。有關適用於此選項的完整詳細資訊和選項,請參閱 buttons.buttons.namespace 的文件。

如果您使用沒有 layout 選項的 DataTables 1.x,請使用此屬性名稱,但請參閱 buttons.buttons.namespace 的文件以了解完整詳細資訊。

範例

具有滑鼠進入/離開(懸停)事件監聽器的按鈕

new DataTable('#myTable', {
	layout: {
		topStart: 'buttons'
	},
	buttons: [
		{
			text: '',
			init: function (e, dt, node, config) {
				node.on('mouseenter' + config.namespace, function () {
					console.log('Mouse enter');
				});

				node.on('mouseleave' + config.namespace, function () {
					console.log('Mouse leave');
				});
			},
			destroy: function (dt, node, config) {
				node.off('mouseenter' + config.namespace);
				node.off('mouseleave' + config.namespace);
			}
		}
	]
});