mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Type Definitions for DataTables Buttons extension.
Added type definitions to support DataTables Buttons extension.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="jquery.dataTables.d.ts" />
|
||||
/// <reference path="jquery.dataTables.buttons.d.ts" />
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var config: DataTables.Settings =
|
||||
{
|
||||
// Buttons extension options
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
className: 'class',
|
||||
exportOptions: {
|
||||
columns: ':visible'
|
||||
}
|
||||
},
|
||||
{
|
||||
action: function (e, dt, node, config) { },
|
||||
available: function (dt, config) { return true; },
|
||||
destroy: function (dt, node, config) { },
|
||||
enabled: true,
|
||||
init: function (dt, node, config) { },
|
||||
key: 'a',
|
||||
name: 'name',
|
||||
namespace: 'namespace',
|
||||
titleAttr: 'title',
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
});
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
// Type definitions for JQuery DataTables (v1.10.10) Buttons extension (v1.1.0)
|
||||
// Project: http://datatables.net/extensions/buttons/
|
||||
// Definitions by: Sam Germano <https://github.com/SammyG4Free>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="jquery.dataTables.d.ts"/>
|
||||
|
||||
declare module DataTables {
|
||||
export interface Settings {
|
||||
/**
|
||||
* Buttons extension options
|
||||
*/
|
||||
buttons?: boolean | string[] | ButtonSettings[];
|
||||
}
|
||||
|
||||
//#region "button-settings"
|
||||
|
||||
/**
|
||||
* Buttons extension options
|
||||
*/
|
||||
export interface ButtonSettings {
|
||||
/**
|
||||
* Action to take when the button is activated
|
||||
*/
|
||||
action?: FunctionButtonAction;
|
||||
|
||||
/**
|
||||
* Ensure that any requirements have been satisfied before initialising a button
|
||||
*/
|
||||
available?: FunctionButtonAvailable;
|
||||
|
||||
/**
|
||||
* Set the class name for the button
|
||||
*/
|
||||
className?: string;
|
||||
|
||||
/**
|
||||
* Function that is called when the button is destroyed
|
||||
*/
|
||||
destroy?: FunctionButtonInit;
|
||||
|
||||
/**
|
||||
* Set a button's initial enabled state
|
||||
*/
|
||||
enabled?: boolean;
|
||||
|
||||
/**
|
||||
* Define which button type the button should be based on
|
||||
*/
|
||||
extend?: string;
|
||||
|
||||
/**
|
||||
* Initialisation function that can be used to add events specific to this button
|
||||
*/
|
||||
init?: FunctionButtonInit;
|
||||
|
||||
/**
|
||||
* Define an activation key for a button
|
||||
*/
|
||||
key?: string | ButtonKey;
|
||||
|
||||
/**
|
||||
* Set a name for each selection
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Unique namespace for every button
|
||||
*/
|
||||
namespace?: string;
|
||||
|
||||
/**
|
||||
* The text to show in the button
|
||||
*/
|
||||
text?: string | ButtonText;
|
||||
|
||||
/**
|
||||
* Button 'title' attribute text
|
||||
*/
|
||||
titleAttr?: string;
|
||||
|
||||
exportOptions?: ButtonExportOptions;
|
||||
autoPrint?: boolean;
|
||||
}
|
||||
|
||||
export interface FunctionButtonAvailable {
|
||||
(dt: DataTables.DataTable, config: any): boolean
|
||||
}
|
||||
export interface ButtonExportOptions {
|
||||
columns?: string;
|
||||
}
|
||||
|
||||
export interface ButtonKey {
|
||||
key?: string;
|
||||
shiftKey?: boolean;
|
||||
altKey?: boolean;
|
||||
ctrlKey?: boolean;
|
||||
metaKey?: boolean;
|
||||
}
|
||||
|
||||
export interface ButtonText {
|
||||
(dt: DataTables.DataTable, node: JQuery, config: any): string
|
||||
}
|
||||
export interface FunctionButtonInit {
|
||||
(dt: DataTables.DataTable, node: JQuery, config: any): void
|
||||
}
|
||||
// api object?
|
||||
export interface FunctionButtonAction {
|
||||
(e: any, dt: DataTables.DataTable, node: JQuery, config: any): void
|
||||
}
|
||||
//#endregion "button-settings
|
||||
}
|
||||
Reference in New Issue
Block a user