From df39576b7453b9468e67fe2cda1bd020d023091d Mon Sep 17 00:00:00 2001 From: Kiarash Date: Tue, 24 Oct 2017 16:37:30 +0200 Subject: [PATCH] Add support for static methods and defaults overwrite for datatables.net (#20685) * Add static methods and default overwrites for datatables.net * Add support for $("selector").dataTable() * Add support for $.fn.dataTable.XXX and $.fn.dataTable.util.XXX * Add support for overwriting datatables.net defaults, see test * Remove fixed comments * Great improvement for datatable.net-buttons * Add all supported plugins for buttons * Better integration in datatables.net d.ts * Fix Api datatables.net * Add support for datatables.net-buttons Api calls Support for button api * Add support for datatables-fixedheader Api * Support for fixedHeader Api calls * Add static functions * Updated test * TSLint all files * TSLint datatables.net, datatables.net-buttoms index.d.ts * Fix travis errors * TSLint Tests * Fix Travis Errors * Fix: Add TypeScript Version * Fix: Set TypeScript Version to 4 * Fix: Test error --- .../datatables.net-buttons-tests.ts | 223 +- types/datatables.net-buttons/index.d.ts | 456 +++- types/datatables.net-buttons/tslint.json | 1 + .../datatables.net-fixedheader-tests.ts | 43 +- types/datatables.net-fixedheader/index.d.ts | 45 +- types/datatables.net/datatables.net-tests.ts | 1899 +++++++++-------- types/datatables.net/index.d.ts | 1820 +++++++++------- types/datatables.net/tslint.json | 1 + 8 files changed, 2633 insertions(+), 1855 deletions(-) create mode 100644 types/datatables.net-buttons/tslint.json create mode 100644 types/datatables.net/tslint.json diff --git a/types/datatables.net-buttons/datatables.net-buttons-tests.ts b/types/datatables.net-buttons/datatables.net-buttons-tests.ts index 3323f6fdb9..46a2069ad7 100644 --- a/types/datatables.net-buttons/datatables.net-buttons-tests.ts +++ b/types/datatables.net-buttons/datatables.net-buttons-tests.ts @@ -1,40 +1,187 @@ -$(document).ready(function () { - - var config: DataTables.Settings = - { - // Buttons extension options - buttons: [ - { - extend: 'excel', - text: 'Excel', - className: 'class', - filename: "exported_file.csv", - exportOptions: { - columns: ':visible' - } - }, - { - extend: 'excel', - text: 'Excel', - className: 'class', - filename: "exported_file.csv", - exportOptions: { - columns: [1, 6, 2, 3, 4] - } - }, - { - 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', - title: 'title' - } - ], +const config_1: DataTables.Settings = { + // Buttons extension options + buttons: [{ + extend: 'excel', + text: 'Excel', + className: 'class', + filename: "exported_file.csv", + exportOptions: { + columns: ':visible' } + }, + { + extend: 'excel', + text: 'Excel', + className: 'class', + filename: "exported_file.csv", + exportOptions: { + columns: [1, 6, 2, 3, 4] + } + }, + { + action(e, dt, node, config) { }, + available(dt, config) { return true; }, + destroy(dt, node, config) { }, + enabled: true, + init(dt, node, config) { }, + key: 'a', + name: 'name', + namespace: 'namespace', + titleAttr: 'title', + title: 'title' + }], +}; -}); \ No newline at end of file +const config_2: DataTables.Settings = { + // Buttons extension options + buttons: { + buttons: [ + "csv", + { + extend: "csv", + name: "CSV-Export", + className: "test-class" + }, + (dt) => { + return { + extend: "csv", + name: "CSV-Function", + className: "test-class" + }; + } + ], + } +}; + +const config_3: DataTables.ButtonsSettings = { + name: "Test", + tabIndex: 1, + buttons: [ + "copy", + { + extend: "csv", + name: "CSV-Export", + className: "test-class" + }, + (dt) => { + return { + extend: "csv", + name: "CSV-Function", + className: "test-class" + }; + }, + { + extend: 'colvis', + columnText(dt, idx, title) { + return (idx + 1) + title; + } + }, + { + extend: 'colvis', + columns: ':gt(0)' + }, + { + extend: 'copy', + text: 'Copy current page', + exportOptions: { + modifier: { + page: 'current' + } + } + }, + { + extend: 'csv', + // Name the CSV + filename: 'file_name', + text: 'Customized CSV', + exportOptions: { + columns: [0, 1, $("#name_column"), $("#test_column"), $("#height_column"), $("#area_column")] + }, + // Function which customize the CSV (input : csv is the object that you can preprocesss) + customize(csv) { + if (typeof (csv) !== "string") { + return; + } + // Split the csv to get the rows + const split_csv = csv.split("\n"); + + // Remove the row one to personnalize the headers + split_csv[0] = '"Latitude","Longitude","Site Name","Description","Antenna Height","Antenna gain","Env loss","Candidate"'; + + // For each row except the first one (header) + $.each(split_csv.slice(1), (index, csv_row) => { + // Split on quotes and comma to get each cell + const csv_cell_array = csv_row.split('","'); + + // Remove replace the two quotes which are left at the beginning and the end (first and last cell) + csv_cell_array[0] = csv_cell_array[0].replace(/"/g, ''); + csv_cell_array[5] = csv_cell_array[5].replace(/"/g, ''); + + // RANDOM EXAMPLE : Make some test, special cutomizing depending of the value of the cell (if cell 5 is equal to a certain value, give a value to row 6) + if (csv_cell_array[5].toLowerCase().trim() === "a certain value") { + csv_cell_array[6] = "2"; + } else if (csv_cell_array[5].toLowerCase() === "another value") { + csv_cell_array[6] = "5"; + } else { + csv_cell_array[6] = ""; + } + + // RANDOM EXAMPLE : Empty the 5th cell and set the 7th to true + csv_cell_array[5] = ""; + csv_cell_array[7] = "true"; + + // Join the table on the quotes and comma; add back the quotes at the beginning and end + const csv_cell_array_quotes = `"${csv_cell_array.join('","')}"`; + + // Insert the new row into the rows array at the previous index (index +1 because the header was sliced) + split_csv[index + 1] = csv_cell_array_quotes; + }); + + // Join the rows with line breck and return the final csv (datatables will take the returned csv and process it) + csv = split_csv.join("\n"); + return csv; + } + } + ], + dom: { + button: { + active: "active" + } + } +}; + +// Statics +const buttons = new $.fn.dataTable.Buttons($("selector").DataTable(), config_3); +const version = $.fn.dataTable.Buttons.version; + +$.fn.dataTable.Buttons.defaults = { + buttons: [] +}; + +$.fn.dataTable.ext.buttons.collection.className += ' dropdown-toggle'; + +// API +let dt = $("selector").DataTable(); + +const export_1 = dt.buttons.exportData({ + columns: '', +}); + +dt.buttons.resize(); + +dt.button(0).action((e, dt, button, config) => { + console.log('Button activated'); +}); + +dt.button().add(0, { + action: (e, dt, button, config) => { + dt.ajax.reload(); + }, + text: 'Reload table' +}); + +dt.button(0) + .nodes() + .css('background', 'blue'); + +dt.buttons().destroy(); diff --git a/types/datatables.net-buttons/index.d.ts b/types/datatables.net-buttons/index.d.ts index 1bdf212b03..e084a50c8d 100644 --- a/types/datatables.net-buttons/index.d.ts +++ b/types/datatables.net-buttons/index.d.ts @@ -1,109 +1,272 @@ -// Type definitions for JQuery DataTables Buttons extension 1.1.0 +// Type definitions for JQuery DataTables Buttons extension 1.4 // Project: http://datatables.net/extensions/buttons/ -// Definitions by: Sam Germano , Jim Hartford +// Definitions by: Kiarash Ghiaseddin , Sam Germano , Jim Hartford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 /// /// declare namespace DataTables { - export interface Settings { + interface Settings { /** * Buttons extension options */ - buttons?: boolean | string[] | ButtonSettings[]; + buttons?: boolean | string[] | ButtonsSettings | ButtonSettings[]; } - //#region "button-settings" + interface StaticFunctions { + Buttons: ButtonStaticFunctions; + } + + interface ButtonStaticFunctions { + new (dt: Api, settings: boolean | string[] | ButtonsSettings | ButtonSettings[]): undefined; + version: string; + defaults: ButtonsSettings; + } + + interface ExtSettings { + buttons: ExtButtonsSettings; + } + + interface Api { + button(groupSelector?: any, buttonSelector?: any): ButtonApi; + buttons: ButtonsGlobalApi; + } + + interface ButtonsGlobalApi { + (groupSelector?: any, buttonSelector?: any): ButtonsApi; - /** - * Buttons extension options - */ - export interface ButtonSettings { /** - * Action to take when the button is activated - */ + * Resize the Flash movie clips to take account of the current button dimensions. + */ + resize(): Api; + + /** + * Display / hide an information message to the end user to indicate that something has happened. + */ + info(title: string, message?: string, time?: number): Api; + + /** + * Get meta information that is common to many different button types. + */ + exportInfo(options?: ButtonsApiExportInfoParameter): ButtonsApiExportInfoReturn; + + /** + * Obtain data from a DataTable that is suitable for exporting by saving into a file or copying to clipboard. + */ + exportData(options?: ButtonsApiExportDataParameter): ButtonsApiExportDataReturn; + } + + interface ButtonApi { + /** + * Get the action function for the selected button. + */ + action(): FunctionButtonAction; + + /** + * Set the action function for the selected button. + */ + action(set: FunctionButtonAction): Api; + + /** + * Get the active state for the selected button. + */ + active(): boolean; + + /** + * Set the active state for the selected button. + */ + active(state: boolean): Api; + + /** + * Create a new button, adding it to the selected button instance and inserting immediately into the document. + */ + add(index: number | string, config: string|FunctionButtom|ButtonSettings): Api; + + /** + * Disable the selected buttons. + */ + disable(): Api; + + /** + * Set the enabled state for the selected button. + */ + enable(state?: boolean): Api; + + /** + * Get a jQuery object that contains a reference to the node for the selected button. + */ + node(): JQuery; + nodes(): JQuery; + + /** + * Determine if a button is currently in the processing state or not. + */ + processing(): boolean; + + /** + * Set the processing state for the selected button. + */ + processing(set: boolean): Api; + + /** + * Set the processing state for the selected button. + */ + processing(set: boolean): Api; + + /** + * Remove the selected button from the display. The button is destroyed and can no longer be used once removed. + */ + remove(): Api; + + /** + * Get / Set the display text for the selected button + */ + text(title?: string | FunctionButtonText): Api; + + /** + * Programmatically trigger the action of the selected button. + */ + trigger(): Api; + } + + interface ButtonsApi extends ButtonApi { + /** + * Get a jQuery instance that contains a reference to the button container instance. + */ + container(): JQuery; + containers(): JQuery; + + /** + * Destroy the selected button instances, removing the container and all button elements from the document. + */ + destroy(): Api; + } + + interface ButtonsApiExportInfoParameter { + extension?: string | (() => string); + filename?: string | (() => string); + messageBottom?: null | string | (() => string); + messageTop?: null | string | (() => string); + title?: null | string | (() => string); + } + + interface ButtonsApiExportInfoReturn { + filename: string; + messageTop: string; + messageBottom: string; + title: string; + } + + interface ButtonsApiExportDataParameter { + rows?: any; + columns?: any; + modifier?: any; + orthogonal?: string; + stripHtml?: boolean; + stripNewlines?: boolean; + decodeEntities?: boolean; + trim?: boolean; + format?: any; + } + + interface ButtonsApiExportDataReturn { + header: string[]; + footer: string[]; + body: string[]; + } + + //#region "Button Settings" + + interface ButtonsSettings { + name?: string; + tabIndex?: number; + buttons: Array; + dom?: ButtonDomSettings; + } + + interface ButtonDomSettings { + button?: ButtonDomButtomButton; + buttonContainer?: ButtonDomButtomCommon; + buttonLiner?: ButtonDomButtomCommon; + collection?: ButtonDomButtomCommon; + container?: ButtonDomButtomCommon; + } + + interface ButtonDomButtomCommon { + className?: string; + tag?: string; + } + + interface ButtonDomButtomButton extends ButtonDomButtomCommon { + active?: string; + disabled?: string; + } + + interface ButtomSettingsCommon { + /** + * Action to take when the button is activated + */ action?: FunctionButtonAction; /** - * Ensure that any requirements have been satisfied before initialising a button - */ + * Ensure that any requirements have been satisfied before initialising a button + */ available?: FunctionButtonAvailable; /** - * Set the class name for the button - */ + * Set the class name for the button + */ className?: string; /** - * Function that is called when the button is destroyed - */ + * Function that is called when the button is destroyed + */ destroy?: FunctionButtonInit; /** - * Set a button's initial enabled state - */ + * Set a button's initial enabled state + */ enabled?: boolean; /** - * Define which button type the button should be based on - */ + * 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 - */ + * Initialisation function that can be used to add events specific to this button + */ init?: FunctionButtonInit; /** - * Define an activation key for a button - */ + * Define an activation key for a button + */ key?: string | ButtonKey; /** - * Set a name for each selection - */ + * Set a name for each selection + */ name?: string; /** - * Unique namespace for every button - */ + * Unique namespace for every button + */ namespace?: string; /** - * The text to show in the button - */ - text?: string | ButtonText; + * The text to show in the button + */ + text?: string | FunctionButtonText; /** - * Button 'title' attribute text - */ + * Button 'title' attribute text + */ titleAttr?: string; - - /** - * Button 'title' text - */ - title?: string; - - /** - * Define what the exported filename should be - */ - filename?: string; - - exportOptions?: ButtonExportOptions; - autoPrint?: boolean; - customize?: FunctionButtonCustomize; } - export interface FunctionButtonAvailable { - (dt: DataTables.Api, config: any): boolean - } - export interface ButtonExportOptions { - columns?: string | number | string[] | number[]; - } - - export interface ButtonKey { + interface ButtonKey { key?: string; shiftKey?: boolean; altKey?: boolean; @@ -111,19 +274,176 @@ declare namespace DataTables { metaKey?: boolean; } - export interface ButtonText { - (dt: DataTables.Api, node: JQuery, config: any): string - } - export interface FunctionButtonInit { - (dt: DataTables.Api, node: JQuery, config: any): void - } - // api object? - export interface FunctionButtonAction { - (e: any, dt: DataTables.Api, node: JQuery, config: any): void + /** + * A function that will be executed upon creation of the buttons. + */ + type FunctionButtom = (dt: Api) => ButtomSettingsCommon; + + type FunctionButtonText = (dt: Api, node: JQuery, config: any) => string; + + type FunctionButtonAvailable = (dt: Api, config: any) => boolean; + + type FunctionButtonInit = (dt: Api, node: JQuery, config: any) => void; + + type FunctionButtonAction = (e: any, dt: Api, node: JQuery, config: ButtonSettings) => void; + + type FunctionButtonCustomize = (win: Window|string) => void; + + type FunctionExtButtonsCollectionText = (a: any) => string; + + interface ExtButtonsSettings { + collection: ExtButtonsCollectionSettings; } - export interface FunctionButtonCustomize { - (win: Window): void + interface ExtButtonsCollectionSettings { + action: FunctionButtonAction; + autoClose: boolean; + background: boolean; + backgroundClassName: string; + className: string; + collectionLayout: string; + fade: number; + text: FunctionExtButtonsCollectionText; } + + //#endregion "Button Defaults" + + //#region "Add-Ons" + + /** + * Buttons extension options + */ + interface ButtonSettings extends ButtomSettingsCommon { + //#region (HTML-)File-Export + + /** + * CSV / EXCEL: Define what the exported filename should be + */ + filename?: string; + + /** + * COPY / CSV: field separator + */ + fieldSeparator?: string; + + /** + * COPY / CSV: field boundary + */ + fieldBoundary?: string; + + /** + * COPY / CSV: field separator + */ + newLine?: string; + + /** + * CSV / EXCEL / PDF: file extension + */ + extension?: string; + + /** + * CSV: UTF-8 boom + */ + bom?: boolean; + + /** + * CSV: charset + */ + charset?: string|boolean; + + /** + * CSV: escape char + */ + escapeChar?: string; + + /** + * EXCEL + */ + customizeData?: FunctionButtonCustomizeData; + + /** + * PDF: portrait / landscape + */ + orientation?: string; + + /** + * PDF: A3 / A4 / A5 / LEGAL / LETTER / TABLOID + */ + pageSize?: string; + + //#endregion (HTML-)File-Export + + //#region Export and Print + + /** + * COPY / CSV / EXCEL / PDF / PRINT: show header + */ + exportOptions?: ButtonExportOptions | object; + + /** + * COPY / CSV / EXCEL / PDF / PRINT: show header + */ + customize?: FunctionButtonCustomize; + + /** + * COPY / CSV / EXCEL / PDF / PRINT: show header + */ + header?: boolean; + + /** + * COPY / CSV / EXCEL / PDF / PRINT: show footer + */ + footer?: boolean; + + /** + * COPY / PRINT: title + */ + title?: string; + + /** + * COPY / EXCEL / PDF / PRINT: field separator + */ + messageTop?: string; + + /** + * COPY / EXCEL / PDF / PRINT: field separator + */ + messageBottom?: string; + + /** + * PDF / PRINT: Extra message + */ + message?: string|Api|JQuery|object; + + /** + * PRINT: Show print dialoge on click + */ + autoPrint?: boolean; + + //#endregion Export and Print + + //#region ColVis + + /** + * COLVIS: Column selector + */ + columns?: any; + + /** + * COLVIS: + */ + columnText?: FunctionButtonColvisColumnText; + + //#endregion ColVis + } + + interface ButtonExportOptions { + columns?: string | number | string[] | number[]; + } + + type FunctionButtonCustomizeData = (content: any) => void; + + type FunctionButtonColvisColumnText = (dt: Api, i: number, title: string) => string; + //#endregion "button-settings } diff --git a/types/datatables.net-buttons/tslint.json b/types/datatables.net-buttons/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/datatables.net-buttons/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts b/types/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts index 72d8665838..4f3e2bfd30 100644 --- a/types/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts +++ b/types/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts @@ -1,11 +1,34 @@ -$(document).ready(() => { - const config: DataTables.Settings = { - // FixedHeader extension options - fixedHeader: { - footer: true, - footerOffset: 4, - header: true, - headerOffset: 3 - } - }; +let config_1: DataTables.Settings = { + // FixedHeader extension options + fixedHeader: { + footer: true, + footerOffset: 4, + header: true, + headerOffset: 3 + } +}; + +let dt: DataTables.Api = $("selector").DataTable({ + fixedHeader: true }); + +// Statics +let fixed_1 = new $.fn.dataTable.FixedHeader(dt, { + footer: true, +}); + +let fixed_2 = new $.fn.dataTable.FixedHeader(dt, true); + +let version = $.fn.dataTable.FixedHeader.version; + +$.fn.dataTable.FixedHeader.defaults.footer = false; + +// API +dt.fixedHeader.adjust(); +dt.fixedHeader.disable(); +dt.fixedHeader.enable(true); + +// Chaining +dt + .fixedHeader.footerOffset(10) + .fixedHeader.headerOffset(10); diff --git a/types/datatables.net-fixedheader/index.d.ts b/types/datatables.net-fixedheader/index.d.ts index cb0b363b65..aa6f87f3b7 100644 --- a/types/datatables.net-fixedheader/index.d.ts +++ b/types/datatables.net-fixedheader/index.d.ts @@ -1,7 +1,9 @@ // Type definitions for datatables.net-fixedheader 3.1 // Project: https://datatables.net/extensions/fixedheader/ -// Definitions by: Jared Szechy +// Definitions by: Jared Szechy , Kiarash Ghiaseddin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + /// /// @@ -13,6 +15,47 @@ declare namespace DataTables { fixedHeader?: boolean | FixedHeaderSettings; } + interface StaticFunctions { + FixedHeader: FixedHeaderStaticFunctions; + } + + interface FixedHeaderStaticFunctions { + new (dt: Api, settings: boolean | FixedHeaderSettings): undefined; + version: string; + defaults: FixedHeaderSettings; + } + + interface Api { + fixedHeader: FixedHeaderApi; + } + + interface FixedHeaderApi { + /** + * Recalculate the position of the DataTable on the page and adjust the fixed element as appropriate. + */ + adjust(): Api; + + /** + * Disable the fixed elements + */ + disable(): Api; + + /** + * Enable / disable the fixed elements + */ + enable(enable: boolean): Api; + + /** + * Get the fixed footer's offset. + */ + footerOffset(offset: number): Api; + + /** + * Get the fixed header's offset. + */ + headerOffset(offset: number): Api; + } + /* * FixedHeader extension options */ diff --git a/types/datatables.net/datatables.net-tests.ts b/types/datatables.net/datatables.net-tests.ts index f4e322dcfc..af722ab74f 100644 --- a/types/datatables.net/datatables.net-tests.ts +++ b/types/datatables.net/datatables.net-tests.ts @@ -1,972 +1,1033 @@ -$(document).ready(function () { - //#region "Language" +//#region "Language" - var lang: DataTables.LanguageSettings = { - "emptyTable": "No data available in table", - "info": "Showing _START_ to _END_ of _TOTAL_ entries", - "infoEmpty": "Showing 0 to 0 of 0 entries", - "infoFiltered": "(filtered from _MAX_ total entries)", - "infoPostFix": "", - "thousands": ",", - "lengthMenu": "Show _MENU_ entries", - "loadingRecords": "Loading...", - "processing": "Processing...", - "search": "Search:", - "searchPlaceholder": "Default text", - "zeroRecords": "No matching records found", - "paginate": { - "first": "First", - "last": "Last", - "next": "Next", - "previous": "Previous" +const lang: DataTables.LanguageSettings = { + emptyTable: "No data available in table", + info: "Showing _START_ to _END_ of _TOTAL_ entries", + infoEmpty: "Showing 0 to 0 of 0 entries", + infoFiltered: "(filtered from _MAX_ total entries)", + infoPostFix: "", + thousands: ",", + lengthMenu: "Show _MENU_ entries", + loadingRecords: "Loading...", + processing: "Processing...", + search: "Search:", + searchPlaceholder: "Default text", + zeroRecords: "No matching records found", + paginate: { + first: "First", + last: "Last", + next: "Next", + previous: "Previous" + }, + aria: { + sortAscending: ": activate to sort column ascending", + sortDescending: ": activate to sort column descending" + } +}; + +//#endregion "Language" + +//#region "Column" + +const colCreatedCellFunc: DataTables.FunctionColumnCreatedCell = (cell, cellData, rowData, rowIndex, colIndex) => {}; + +const colDataObject: DataTables.ObjectColumnData = { + _: "phone", + filter: "phone_filter", + display: "phone_display", + sort: "asc" +}; + +const colDataFunc: DataTables.FunctionColumnData = (row: any, type: 'set' | 'display' | 'sort' | 'filter' | 'type', set: any, meta: DataTables.CellMetaSettings) => { + meta.col; + meta.row; + meta.settings; + switch (type) { + case 'set': + row.value = set; + return; + default: + return row.value; + } +}; + +const colRenderObject: DataTables.ObjectColumnData = { + _: "phone", + filter: "phone_filter", + display: "phone_display", + sort: "asc" +}; + +const colRenderFunc: DataTables.FunctionColumnRender = (data: any, type: any, row: any, meta: DataTables.CellMetaSettings): any => { + meta.col; + meta.row; + meta.settings; + switch (type) { + case undefined: + return data.value; + case 'filter': + return data.filterValue; + case 'display': + return data.displayValue; + case 'type': + return data.typeValue; + case 'sort': + return data.sortValue; + default: + // Extensibility: the render type can be a custom value, useful for plugins that require custom rendering. + // Custom values are declared as any. + return data.valueForPlugin; + } +}; + +colRenderFunc({}, 'filter', {}, null); +colRenderFunc({}, 'display', {}, null); +colRenderFunc({}, 'type', {}, null); +colRenderFunc({}, 'sort', {}, null); +colRenderFunc({}, undefined, {}, null); +colRenderFunc({}, 'custom value', {}, null); + +let col: DataTables.ColumnSettings = { + cellType: "th", + className: "css", + contentPadding: "mmmm", + createdCell: colCreatedCellFunc, + data: 1, + defaultContent: "edit", + name: "name", + orderable: true, + orderData: 10, + orderDataType: "dom-checkbox", + orderSequence: ['asc', 'desc'], + render: 1, + searchable: true, + title: "title", + visible: true, + width: "200px" +}; +col = { + data: "", + orderData: [10, 11, 20], + render: "", +}; +col = { + data: colDataObject, + render: colRenderObject, +}; +col = { + data: colDataFunc, + render: colRenderFunc, +}; + +//#endregion "Column" + +//#region "ColumnDef" + +let colDef: DataTables.ColumnDefsSettings = { + targets: 1, + cellType: "th", + className: "css", + contentPadding: "mmmm", + createdCell: colCreatedCellFunc, + data: 1, + defaultContent: "edit", + name: "name", + orderable: true, + orderData: 10, + orderDataType: "dom-checkbox", + orderSequence: ['asc', 'desc'], + render: 1, + searchable: true, + title: "title", + visible: true, + width: "200px" + }; + +colDef = { + targets: "2", + cellType: "th", + }; + +colDef = { + targets: ["2", 5], + cellType: "th", + }; + +//#endregion "ColumnDef" + +//#region "Callbacks" + +const createRowFunc: DataTables.FunctionCreateRow = (row, data, dataIndex) => { }; +const drawCallbackFunc: DataTables.FunctionDrawCallback = (settings) => { }; +const footerCallbackFunc: DataTables.FunctionFooterCallback = (tfoot, data, start, end, display) => { }; +const formatNumberFunc: DataTables.FunctionFormatNumber = (toForm) => { }; +const headerCallbackFunc: DataTables.FunctionHeaderCallback = (thead, data, start, end, display) => { }; +const infoCallbackFunc: DataTables.FunctionInfoCallback = (settings, start, end, total, pre) => { }; +const initCallbackFunc: DataTables.FunctionInitComplete = (settings, json) => { }; +const preDrawFunc: DataTables.FunctionPreDrawCallback = (settings) => { }; +const rowCallbackFunc: DataTables.FunctionRowCallback = (row, data, index) => { }; +const stateLoadCallbackFunc: DataTables.FunctionStateLoadCallback = (settings) => { }; +const stateLoadedCallbackFunc: DataTables.FunctionStateLoaded = (settings, data) => { }; +const stateSaveCallbackFunc: DataTables.FunctionStateSaveCallback = (settings, data) => { }; +const stateSaveParamsFunc: DataTables.FunctionStateSaveParams = (settings, data) => { }; + +//#endregion "Callbacks + +//#region "Ajax" + +const ajaxFunc: DataTables.FunctionAjax = (data, callback, settings) => { }; + +let ajaxDataFunc: DataTables.FunctionAjaxData = (data, settings) => data; + +ajaxDataFunc = (data) => ""; + +//#endregion "Ajax" + +//#region "Settings" + +let config: DataTables.Settings = { + // columns + columns: [ + col, + null, + col, + null, + col, + col + ], + columnDefs: [ + null, + colDef, + colDef, + null, + ], + // Data + ajax: "url", + data: {}, + // Features + autoWidth: true, + deferRender: true, + info: true, + jQueryUI: false, + lengthChange: true, + ordering: true, + paging: true, + scrollX: true, + scrollY: "200px", + searching: true, + serverSide: true, + stateSave: true, + // Options + deferLoading: 10, + destroy: true, + displayStart: 1, + dom: "lrtip", + lengthMenu: [1, 2, 3, 4], + orderCellsTop: true, + orderClasses: true, + order: [[0, 'asc'], [1, 'asc']], + orderFixed: [[0, 'asc'], [1, 'asc']], + orderMulti: true, + pageLength: 10, + pagingType: "simple", + retrieve: true, + renderer: "bootstrap", + rowId: "custId", + scrollCollapse: true, + search: true, + searchCols: [{ search: "", smart: true, regex: false, caseInsensitive: true }], + searchDelay: 10, + stateDuration: 10, + tabIndex: 10, + }; + +config = { + ajax: ajaxFunc, + deferLoading: [10, 100], + lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], + order: [0, 'asc'], + orderFixed: [[0, 'asc'], [1, 'asc']], + renderer: { + header: "bootstrap", + pageButton: "jqueryui" }, - "aria": { - "sortAscending": ": activate to sort column ascending", - "sortDescending": ": activate to sort column descending" - } + search: { search: "", smart: true, regex: false, caseInsensitive: true }, + searchCols: [ + null, + { search: "", smart: true, regex: false, caseInsensitive: true }, + { search: "" }, + { search: "", smart: true }, + null + ], }; - //#endregion "Language" - - //#region "Column" - - var colCreatedCellFunc: DataTables.FunctionColumnCreatedCell = function (cell, cellData, rowData, rowIndex, colIndex) { - - } - - var colDataObject: DataTables.ObjectColumnData = { - _: "phone", - filter: "phone_filter", - display: "phone_display", - sort: "asc" - }; - - var colDataFunc: DataTables.FunctionColumnData = (row: any, type: 'set' | 'display' | 'sort' | 'filter' | 'type', set: any, meta: DataTables.CellMetaSettings) => { - meta.col; - meta.row; - meta.settings; - switch (type) { - case 'set': - row.value = set; - return; - default: - return row.value; - } - }; - - var colRenderObject: DataTables.ObjectColumnRender = { - _: "phone", - filter: "phone_filter", - display: "phone_display", - sort: "asc" - }; - - var colRenderFunc: DataTables.FunctionColumnRender = (data: any, type: 'filter' | 'display' | 'type' | 'sort' | undefined | any, row: any, meta: DataTables.CellMetaSettings): any => { - meta.col; - meta.row; - meta.settings; - switch (type) { - case undefined: - return data.value; - case 'filter': - return data.filterValue; - case 'display': - return data.displayValue; - case 'type': - return data.typeValue; - case 'sort': - return data.sortValue; - default: - // Extensibility: the render type can be a custom value, useful for plugins that require custom rendering. - // Custom values are declared as any. - return data.valueForPlugin; - } - }; - - colRenderFunc({}, 'filter', {}, null); - colRenderFunc({}, 'display', {}, null); - colRenderFunc({}, 'type', {}, null); - colRenderFunc({}, 'sort', {}, null); - colRenderFunc({}, undefined, {}, null); - colRenderFunc({}, 'custom value', {}, null); - - var col: DataTables.ColumnSettings = - { - cellType: "th", - className: "css", - contentPadding: "mmmm", - createdCell: colCreatedCellFunc, - data: 1, - defaultContent: "edit", - name: "name", - orderable: true, - orderData: 10, - orderDataType: "dom-checkbox", - orderSequence: ['asc', 'desc'], - render: 1, - searchable: true, - title: "title", - visible: true, - width: "200px" - } - col = - { - data: "", - orderData: [10, 11, 20], - render: "", - } - col = - { - data: colDataObject, - render: colRenderObject, - } - col = - { - data: colDataFunc, - render: colRenderFunc, - } - - //#endregion "Column" - - //#region "ColumnDef" - - var colDef: DataTables.ColumnDefsSettings = - { - targets: 1, - cellType: "th", - className: "css", - contentPadding: "mmmm", - createdCell: colCreatedCellFunc, - data: 1, - defaultContent: "edit", - name: "name", - orderable: true, - orderData: 10, - orderDataType: "dom-checkbox", - orderSequence: ['asc', 'desc'], - render: 1, - searchable: true, - title: "title", - visible: true, - width: "200px" - }; - - colDef = - { - targets: "2", - cellType: "th", - }; - - colDef = - { - targets: ["2", 5], - cellType: "th", - }; - - //#endregion "ColumnDef" - - //#region "Callbacks" - - var createRowFunc: DataTables.FunctionCreateRow = function (row, data, dataIndex) { }; - var drawCallbackFunc: DataTables.FunctionDrawCallback = function (settings) { }; - var footerCallbackFunc: DataTables.FunctionFooterCallback = function (tfoot, data, start, end, display) { }; - var formatNumberFunc: DataTables.FunctionFormatNumber = function (toForm) { }; - var headerCallbackFunc: DataTables.FunctionHeaderCallback = function (thead, data, start, end, display) { }; - var infoCallbackFunc: DataTables.FunctionInfoCallback = function (settings, start, end, total, pre) { }; - var initCallbackFunc: DataTables.FunctionInitComplete = function (settings, json) { }; - var preDrawFunc: DataTables.FunctionPreDrawCallback = function (settings) { }; - var rowCallbackFunc: DataTables.FunctionRowCallback = function (row, data, index) { }; - var stateLoadCallbackFunc: DataTables.FunctionStateLoadCallback = function (settings) { }; - var stateLoadedCallbackFunc: DataTables.FunctionStateLoaded = function (settings, data) { }; - var stateSaveCallbackFunc: DataTables.FunctionStateSaveCallback = function (settings, data) { }; - var stateSaveParamsFunc: DataTables.FunctionStateSaveParams = function (settings, data) { }; - - //#endregion "Callbacks - - //#region "Ajax" - - var ajaxFunc: DataTables.FunctionAjax = function (data, callback, settings) { }; - - var ajaxDataFunc: DataTables.FunctionAjaxData = function (data, settings) { - return data; - }; - - ajaxDataFunc = function (data) { - return ""; - }; - - //#endregion "Ajax" - - //#region "Settings" - - var config: DataTables.Settings = - { - // columns - columns: [ - col, - null, - col, - null, - col, - col - ], - columnDefs: [ - null, - colDef, - colDef, - null, - ], - // Data - ajax: "url", +config = { + ajax: { data: {}, - // Features - autoWidth: true, - deferRender: true, - info: true, - jQueryUI: false, - lengthChange: true, - ordering: true, - paging: true, - scrollX: true, - scrollY: "200px", - searching: true, - serverSide: true, - stateSave: true, - // Options - deferLoading: 10, - destroy: true, - displayStart: 1, - dom: "lrtip", - lengthMenu: [1, 2, 3, 4], - orderCellsTop: true, - orderClasses: true, - order: [[0, 'asc'], [1, 'asc']], - orderFixed: [[0, 'asc'], [1, 'asc']], - orderMulti: true, - pageLength: 10, - pagingType: "simple", - retrieve: true, - renderer: "bootstrap", - rowId: "custId", - scrollCollapse: true, - search: true, - searchCols: [{ "search": "", "smart": true, "regex": false, "caseInsensitive": true }], - searchDelay: 10, - stateDuration: 10, - tabIndex: 10, - }; - - - config = - { - ajax: ajaxFunc, - deferLoading: [10, 100], - lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], - order: [0, 'asc'], - orderFixed: [[0, 'asc'], [1, 'asc']], - renderer: { - header: "bootstrap", - pageButton: "jqueryui" - }, - search: { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, - searchCols: [ - null, - { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, - { "search": "" }, - { "search": "", "smart": true }, - null - ], - }; - - config = - { - ajax: { - data: {}, - dataSrc: "", - }, - }; - - config = - { - ajax: { - data: ajaxDataFunc, - dataSrc: function (data: any) { }, - }, - }; - - //#endregion "Settings" - - //#region "Settings-Legacy" - - var browserLegacy: DataTables.BrowserLegacy = { - barWidth: 10, - bBounding: true, - bScrollbarLeft: true, - bScrollOversize: true - } - - //#endregion - - //#region "Init" - - var dt = $('#example').DataTable(); - dt = $('#example1').DataTable(config); - dt = $('#example1').DataTable(config); - dt.$('tr:odd').css('backgroundColor', 'blue'); - - //#endregion "Init" - - //#region "Methods-Ajax" - - var json = dt.ajax.json(); - - var params = dt.ajax.params(); - - var reload = dt.ajax.reload(); - reload = dt.ajax.reload(function () { }); - reload = dt.ajax.reload(function () { }, true); - var test = reload.$(""); - - var url = dt.ajax.url(); - dt.ajax.url("url"); - dt.ajax.url("url").load(); - - //#endregion "Methods-Ajax" - - //#region "Methods-Core" - - var clear = dt.clear(); - clear.$(""); - - var data = dt.data(); - data.$(""); - - var destroy = dt.destroy(); - destroy = dt.destroy(true); - destroy.$(""); - - var draw: DataTables.Api = dt.draw(); - draw = dt.draw(true); - draw = dt.draw("page"); - draw.$(""); - - var initSettings = dt.init(); - - var i18n: string = dt.i18n('buttons.copy', 'Copy to clipboard'); - i18n = dt.i18n('select.rows', { _: '%d rows selected', 1: '1 row selected' }, 0); - - var off = dt.off("event"); - off = dt.off("event", function () { }); - off.$(""); - - var on = dt.on("event", function () { }); - on.$(""); - - var one = dt.one("event", function () { }); - one.$(""); - - var order_get = dt.order(); - var order_set = dt.order([0, "asc"]); - order_set = dt.order([0, "asc"], [1, "desc"]); // TODO: Fíx that - order_set = dt.order([[0, "asc"], [1, "desc"]]); - - var orderListerner = order_set.order.listener("node", 1, function () { }); - - var page_get = dt.page(); - var page_set = dt.page(1); - page_set = dt.page("next"); - - var page = dt.page.info(); - page = { - "page": 1, - "pages": 6, - "start": 10, - "end": 20, - "length": 10, - "recordsTotal": 57, - "recordsDisplay": 57, - "serverSide": false + dataSrc: "", + }, }; - var page_len_get = dt.page.len(); - var page_len_set = dt.page.len(10); - - var search_get = dt.search(); - var search_set = dt.search("searchStr"); - search_set = dt.search("searchStr", true); - search_set = dt.search("searchStr", true, false); - search_set = dt.search("searchStr", true, false, false); - - var settings = dt.settings(); - - var state = dt.state(); - state = { "time": 1423772610230, "start": 0, "length": 25, "order": [[0, "asc"]], "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, "columns": [{ "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }, { "visible": true, "search": { "search": "", "smart": true, "regex": false, "caseInsensitive": true } }] }; - state = dt.state.loaded(); - - var state_clear = dt.state.clear(); - state_clear.$(""); - - var state_save = dt.state.save(); - state_save.$(""); - - //#endregion "Methods-Core" - - var modifier: DataTables.ObjectSelectorModifier = { - order: "current", - search: "none", - searchPlaceholder: "Default text", - page: "all", +config = { + ajax: { + data: ajaxDataFunc, + dataSrc() { + return []; + }, + }, }; - //#region "Methods-Cell" +//#endregion "Settings" - var cells = dt.cells(); - cells = dt.cells(":contains('Not shipped')"); - cells = dt.cells(function () { }); - cells = dt.cells($("")); - cells = dt.cells({}); - cells = dt.cells(":contains('Not shipped')r", modifier); - cells = dt.cells("row-selector", "cells-selector", modifier); +//#region "Settings-Legacy" - var cells_cache = cells.cache("search"); - // Create the select list and search operation - var select = $('') + .appendTo('body') + .on('change', () => { + dt + .column(0) + .search($(this).val() as string) + .draw(); + }); +// Get the search data for the first column and add to the select list +const data_3 = dt + .cells('', 0) + .cache('search') + .sort() + .unique() + .each((d: any) => { + const tag = ``; + select.append($(tag)); + }); + +const cells_data = cells.data(); +const data_4 = dt + .cells(".info") + .data(); + +console.log(data_4); + +const cells_indexes = cells.indexes(); +const columns_d = dt + .cells(':contains("21")') + .indexes() + .pluck('column') + .sort() + .unique(); + +alert('Columns containing 21: ' + columns_d.join(', ')); + +const cells_invalidate_1 = cells.invalidate(); +const cells_invalidate_2 = cells.invalidate("data"); +const td = $('#example tbody td:eq(0)'); +td.html('Updated'); +dt.cell(td).invalidate().draw(); + +const cells_nodes = cells.nodes(); +const cells_d = dt + .cells(":contains('Not shipped')") + .nodes(); + +$(cells_d).addClass('warning'); + +const cells_render = cells.render("display"); +$('#example').on('click', 'tbody td', () => { + const idx = dt.cell(this).index().row; + const data = dt.cells(idx, '').render('display'); console.log(data); +}); - var cells_indexes = cells.indexes(); - var columns_d = dt - .cells(':contains("21")') - .indexes() - .pluck('column') - .sort() - .unique(); +cells.every(() => { }); +cells.every((cellRowIdx, cellColIdx, tableLoop, cellLoop) => { }); - alert('Columns containing 21: ' + columns_d.join(', ')); +let cell = dt.cell(":contains('Not shipped')"); +cell = dt.cell(() => { }); +cell = dt.cell($("")); +cell = dt.cell({}); +cell = dt.cell(":contains('Not shipped')r", modifier); +cell = dt.cell("row-selector", "cells-selector", modifier); - var cells_invalidate = cells.invalidate(); - var cells_invalidate = cells.invalidate("data"); - var td = $('#example tbody td:eq(0)'); - td.html('Updated'); - dt.cell(td).invalidate().draw(); +const cell_cache = cell.cache("search"); +$('#example tbody').on('click', 'td', () => { + alert(dt.cell(this).cache('order')); +}); - var cells_nodes = cells.nodes(); - var cells_d = dt - .cells(":contains('Not shipped')") - .nodes(); +const cell_data_get = cell.data(); +$('#example tbody').on('click', 'td', () => { + alert(dt.cell(this).data()); +}); - $(cells_d).addClass('warning'); +let cell_data_set = cell.data("string"); +cell_data_set = cell.data(1); +$('#example tbody').on('click', 'td', () => { + const cell = dt.cell(this); + cell.data(cell.data() + 1).draw(); +}); - var cells_render = cells.render("display"); - $('#example').on('click', 'tbody td', function () { - var idx = dt.cell(this).index().row; - var data = dt.cells(idx, '').render('display'); +const cell_index = cell.index(); +$('#example tbody').on('click', 'td', () => { + alert('Clicked on cell in visible column: ' + dt.cell(this).index().columnVisible); +}); +$('#example tbody').on('click', 'td', () => { + const rowIdx = dt + .cell(this) + .index().row; - console.log(data); - }); - - cells.every(function () { }); - cells.every(function (cellRowIdx, cellColIdx, tableLoop, cellLoop) { }); - - var cell = dt.cell(":contains('Not shipped')"); - cell = dt.cell(function () { }); - cell = dt.cell($("")); - cell = dt.cell({}); - cell = dt.cell(":contains('Not shipped')r", modifier); - cell = dt.cell("row-selector", "cells-selector", modifier); - - var cell_cache = cell.cache("search"); - $('#example tbody').on('click', 'td', function () { - alert(dt.cell(this).cache('order')); - }); - - var cell_data_get = cell.data(); - $('#example tbody').on('click', 'td', function () { - alert(dt.cell(this).data()); - }); - - var cell_data_set = cell.data("string"); - cell_data_set = cell.data(1); - $('#example tbody').on('click', 'td', function () { - var cell = dt.cell(this); - cell.data(cell.data() + 1).draw(); - }); - - var cell_index = cell.index(); - $('#example tbody').on('click', 'td', function () { - alert('Clicked on cell in visible column: ' + dt.cell(this).index().columnVisible); - }); - $('#example tbody').on('click', 'td', function () { - var rowIdx = dt - .cell(this) - .index().row; - - dt.rows(rowIdx) - .nodes() - .to$() - .addClass('clicked'); - }); - - var cell_invalidate = cell.invalidate(); - var cell_invalidate = cell.invalidate("data"); - $('#example tbody').on('click', 'td', function () { - this.innerHTML = (parseInt(this.innerHTML) + 1).toString(); - dt.cell(this).invalidate().draw(); - }); - - var cell_nodes = cell.node(); - var cell_n = dt - .cell("#importantCell") - .node(); - - $(cell_n).addClass('warning'); - - var cell_render = cell.render("display"); - $('#example').on('click', 'tbody td', function () { - var data = dt.cell(this).render('display'); - - console.log(data); - }); - $('#example').on('click', 'tbody td', function () { - var data = dt.cell(this).render('sort'); - - console.log(data); - }); - - //#endregion "Methods-Cell" - - //#region "Methods-Column" - - var columns = dt.columns(); - columns = dt.columns("selector"); - columns = dt.columns("selector", modifier); - - var columns_cache = columns.cache("order"); - dt.columns('.select-filter').eq(0).each(function (colIdx: any) { - // Create the select list and search operation - var select = $('') + const select = $('') + .appendTo( + dt.column(0).footer() + ) + .on('change', () => { dt - .column(4) - .data() - .reduce(function (a: any, b: any) { - return a + b; - }) - ); - - var column_dataSrc = column.dataSrc(); - $('#example').on('click', 'tbody td', function () { - var idx = dt.cell(this).index().column; - alert('Data source: ' + dt.column(idx).dataSrc()); - }); - - var column_footer = column.footer(); - var column_p = dt.column(0); - //$(column.footer()).html( - // column_p - // .data() - // .reduce(function (a, b) { - // return a + b; - // }) - // ); - - var column_header = column.header(); - $('#example tbody').on('click', 'td', function () { - var idx = dt.cell(this).index().column; - var title = dt.column(idx).header(); - - alert('Column title clicked on: ' + $(title).html()); - }); - - var column_index = column.index(); - column_index = column.index("visibile"); - dt.column(0).visible(false); - - var idx = dt.column(1).index('visible'); - alert(idx); // will show 0 - - dt.column('0:visible').order('asc'); - - var column_nodes = column.nodes(); - dt.column(-1) - .nodes() - //.to$() // Convert to a jQuery object - //.addClass('ready'); - - var column_search_get = column.search(); - var column_search_set = column.search("string"); - column_search_set = column.search("string", true); - column_search_set = column.search("string", true, false); - column_search_set = column.search("string", true, false, true); - $('#column3_search').on('keyup', function () { - dt - .columns(3) - .search((this as HTMLInputElement).value) + .column(0) + .search($(this).val() as string) .draw(); }); - dt.columns('.select-filter').eq(0).each(function (colIdx: any) { - // Create the select list and search operation - var select = $('') + .appendTo( + dt.column(colIdx).footer() + ) + .on('change', function() { + dt + .column(colIdx) + .search($(this).val() as string) + .draw(); + }); + + // Get the search data for the first column and add to the select list + dt + .column(colIdx) + .cache('search') + .sort() + .unique() + .each((d: any) => { + const tag = ``; + select.append($(tag)); + }); +}); + +const column_visible_get = column.visible(); +let column_visible_set = column.visible(false); +column_visible_set = column.visible(false, true); +alert('Column index 0 is ' + + (dt.column(0).visible() ? 'visible' : 'not visible') +); +for (let i = 0; i < 4; i++) { + dt.column(i).visible(false, false); +} +dt.columns.adjust().draw(false); // adjust column sizing and redraw + +dt.columns().every(() => { }); +dt.columns().every((colIdx, tableLoop, colLoop) => { }); + +//#endregion "Methods-Column" + +//#region "Methods-Row" + +const row_1 = dt.row("selector"); +const row_2 = dt.row("selector").child.hide(); +const row_3 = dt.row("selector").child.isShown(); +const row_4 = dt.row("selector").child.remove(); +const row_5 = dt.row("selector").child.show(); +const row_6 = dt.row("selector").child(); +const row_7 = dt.row("selector").child(false); +const row_8 = dt.row("selector").child(false).hide(); +const row_9 = dt.row("selector").child("data"); +const row_10 = dt.row("selector").child("data").remove(); +const row_11 = dt.row("selector").child("data", "css").show(); +const row_12 = dt.row("selector").child.remove(); +const row_13 = dt.row("selector").child.show(); +const row_14 = dt.row.add({}); +const row_15 = dt.row("selector").invalidate(); +const row_16 = dt.row("selector").invalidate("auto"); +const row_17 = dt.row("selector").data(); +const row_18 = dt.row("selector").data({}); +const row_19 = dt.row("selector").index(); +const row_20 = dt.row("selector").node(); +const row_21 = dt.row("selector").remove(); +const row_22: string = dt.row("selector").id(); +const row_23: string = dt.row("selector").id(false); + +const rows_1 = dt.rows(); +const rows_2 = dt.rows().remove(); +const rows_3 = dt.rows("selector"); +const rows_4 = dt.rows("selector").cache("type"); +const rows_5 = dt.rows("selector").data(); +const rows_6 = dt.rows("selector").data({}); +const rows_7 = dt.rows("selector").indexes(); +const rows_8 = dt.rows("selector").invalidate(); +const rows_9 = dt.rows("selector").invalidate("auto"); +const rows_10 = dt.rows("selector").indexes(); +const rows_11 = dt.rows("selector").remove(); +const rows_12 = dt.rows("selector").nodes(); +const rows_13 = dt.rows.add([{}, {}]); +dt.rows().every(() => { }); +dt.rows().every((rowIdx, tableLoop, rowLoop) => { }); +const rows_14: DataTables.Api = dt.rows("selector").ids(); +const rows_15: DataTables.Api = dt.rows("selector").ids(false); + +const table3 = $('#example').DataTable(); +table3.row.add({ + name: "Tiger Nixon", + position: "System Architect", + salary: "$3,120", + start_date: "2011/04/25", + office: "Edinburgh", + extn: "5421" +}).draw(); + +const table4 = $('#example').DataTable(); +table4.row.add([{ + name: "Tiger Nixon", + position: "System Architect", + salary: "$3,120", + start_date: "2011/04/25", + office: "Edinburgh", + extn: "5421" +}, { + name: "Garrett Winters", + position: "Director", + salary: "$5,300", + start_date: "2011/07/25", + office: "Edinburgh", + extn: "8422" +}]) + .draw(); + +let pupil: any; +const table5 = $('#example').DataTable(); +table5.rows.add([ + pupil, + pupil, + pupil, +]) + .draw(); +// .nodes() +// .to$() +// .addClass('new'); + +$('#example tbody').on('click', 'td.details-control', () => { + const tr = $(this).parents('tr'); + const row = dt.row(tr); + + if (row.child.isShown()) { + // This row is already open - close it + row.child.hide(); + tr.removeClass('shown'); + } else { + // Open this row (the format() function would return the data to be shown) + row.child("").show(); + tr.addClass('shown'); + } +}); + +dt.row(':eq(0)').child([ + 'First child row', + 'Second child row', + 'Third child row' +]) + .show(); + +dt.rows().eq(0).each((rowIdx: any) => { + const tag = `${rowIdx}.1${rowIdx}.2${rowIdx}.3${rowIdx}.4`; + dt + .row(rowIdx) + .child( + $(tag) + ) + .show(); +}); + +$('#example tbody').on('click', 'td.details-control', () => { + const tr = $(this).parents('tr'); + const row = dt.row(tr); + + if (row.child.isShown()) { + // This row is already open - close it + row.child.hide(); + tr.removeClass('shown'); + } else { + // Open this row (the format() function would return the data to be shown) + row.child("").show(); + tr.addClass('shown'); + } +}); + +$('#example tbody').on('click', 'td.details-control', () => { + const tr = $(this).parents('tr'); + const row = dt.row(tr); + + if (row.child.isShown()) { + // This row is already open - remove it + row.child.remove(); + tr.removeClass('shown'); + } else { + // Open this row (the format() function would return the data to be shown) + row.child("").show(); + tr.addClass('shown'); + } +}); + +//#endregion "Methods-Row" + +//#region "Methods-Static" + +// Variable is a stand-in for $.fn.dataTable. See extension of JQueryStatic at the top of index.d.ts. +let staticFn: DataTables.StaticFunctions; + +// With boolean parameter type, always returns DataTables.DataTable[]. +let static_1: DataTables.Api[] = staticFn.tables(true); + +// With object parameter type, returns DataTables.DataTable[] when "api" property is false. +static_1 = staticFn.tables({ visible: true, api: false }); + +// With object parameter type, returns DataTables.DataTable when "api" property is true. +const static_2: DataTables.Api = staticFn.tables({ visible: true, api: true }); + +const static_3: DataTables.Api = $("selector").DataTable(); +const static_4: DataTables.JQueryDataTables = $("selector").dataTable(); +const static_5: DataTables.Api = $("selector").dataTable().api(); + +const static_6 = new $.fn.dataTable.Api("selector"); + +const version: boolean = $.fn.dataTable.versionCheck("1.10.0"); +const isDataTable: boolean = $.fn.dataTable.isDataTable("selector"); +const escapeRegex: string = $.fn.dataTable.util.escapeRegex(""); + +const throttle_1 = $.fn.dataTable.util.throttle((data) => { + table.search(data).draw(); +}); + +const throttle_2 = $.fn.dataTable.util.throttle((data) => { + table.search(data).draw(); +}, 100); + +const defaults_1 = $.fn.dataTable.defaults; + +//#endregion "Methods-Static" + +//#region "Default Overwrite" + +/* Default table settings */ +const defaults_2: DataTables.Settings = { + dom: "<'row'<'col-lg-5'f><'col-lg-7'Bl>>" + + "<'row'<'col-lg-12't>>" + + "<'row'<'col-lg-5'i><'col-lg-7'p>>Ox", + paging: true, + pagingType: "bootstrap", + stateSave: true, + language: { + infoEmpty: "Empty" + } +}; + +/* Default class names */ +const default_classes: DataTables.ExtClassesSettings = { + sWrapper: "dataTables_wrapper dt-bootstrap4", + sFilterInput: "form-control", + sLength: "dataTables_length", + sLengthSelect: "form-control custom-select", + sProcessing: "dataTables_processing panel panel-default", + sPageButton: "paginate_button page-item", +}; + +//#endregion "Default Overwrite" + +//#region "Methods-Table" + +let tables = dt.tables(); +tables = dt.tables("selector"); + +const tables_body = tables.body(); +const tables_containers = tables.containers(); +const tables_footer = tables.footer(); +const tables_header = tables.header(); +const tables_nodes = tables.nodes(); + +const table = dt.table("selector"); + +const table_body = table.body(); +const table_container = table.container(); +const table_footer = table.footer(); +const table_header = table.header(); +const table_node = table.node(); + +//#endregion "Methods-Table" + +//#region "Methods-Util" + +const util_1: boolean = dt.any(); +const util_2: number = dt.count(); + +//#endregion "Methods-Util" diff --git a/types/datatables.net/index.d.ts b/types/datatables.net/index.d.ts index 85f6d05857..7cd4b8589b 100644 --- a/types/datatables.net/index.d.ts +++ b/types/datatables.net/index.d.ts @@ -1,91 +1,101 @@ -// Type definitions for JQuery DataTables 1.10.9 +// Type definitions for JQuery DataTables 1.10 // Project: http://www.datatables.net -// Definitions by: Kiarash Ghiaseddin , Omid Rad , Armin Sander , Denise Mauldin +// Definitions by: Kiarash Ghiaseddin , Omid Rad , Armin Sander // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 // missing: -// - Static methods that are defined in JQueryStatic.fn are not typed. -// - Plugin and extension definitions are not typed. // - Some return types are not fully working /// interface JQuery { DataTable(opts?: DataTables.Settings): DataTables.Api; + dataTable: DataTables.StaticFunctions; } -//TODO: Wrong, as jquery.d.ts has no interface for fn -//interface JQueryStatic { -// dataTable: DataTables.StaticFunctions; -//} - declare namespace DataTables { - export interface Api extends CoreMethods { + interface JQueryDataTables extends JQuery { /** - * Get the data for the whole table. - */ + * Returns DataTables API instance + * Usage: + * $( selector ).dataTable().api(); + */ + api(): Api; + } + + interface Api extends CoreMethods { + /** + * Returns DataTables API instance + * + * @param table Selector string for table + */ + (selector: string | Node | Node[] | JQuery): Api; + + /** + * Get the data for the whole table. + */ data(): Api; /** - * Order Methods / Object - */ + * Order Methods / object + */ order: OrderMethods; //#region "Cell/Cells" /** - * Select the cell found by a cell selector - * - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - cell(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods; + * Select the cell found by a cell selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering + */ + cell(cellSelector: any, modifier?: ObjectSelectorModifier): CellMethods; /** - * Select the cell found by a cell selector - * - * @param rowSelector Row selector. - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - cell(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods; + * Select the cell found by a cell selector + * + * @param rowSelector Row selector. + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering + */ + cell(rowSelector: any, cellSelector: any, modifier?: ObjectSelectorModifier): CellMethods; /** - * Select all cells - * - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ + * Select all cells + * + * @param Option used to specify how the cells should be ordered, and if paging or filtering + */ cells(modifier?: ObjectSelectorModifier): CellsMethods; /** - * Select cells found by a cell selector - * - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - cells(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods; + * Select cells found by a cell selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering + */ + cells(cellSelector: any, modifier?: ObjectSelectorModifier): CellsMethods; /** - * Select cells found by both row and column selectors - * - * @param rowSelector Row selector. - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ - cells(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods; + * Select cells found by both row and column selectors + * + * @param rowSelector Row selector. + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering + */ + cells(rowSelector: any, cellSelector: any, modifier?: ObjectSelectorModifier): CellsMethods; //#endregion "Cell/Cells" //#region "Column/Columns" /** - * Column Methods / Object - */ + * Column Methods / object + */ column: ColumnMethodsModel; /** - * Columns Methods / Object - */ + * Columns Methods / object + */ columns: ColumnsMethodsModel; //#endregion "Column/Columns" @@ -93,67 +103,62 @@ declare namespace DataTables { //#region "Row/Rows" /** - * Row Methode / Object - */ - row: RowMethodsModel + * Row Methode / object + */ + row: RowMethodsModel; /** - * Rows Methods / Object - */ - rows: RowsMethodsModel + * Rows Methods / object + */ + rows: RowsMethodsModel; //#endregion "Row/Rows" //#region "Table/Tables" /** - * Select a table based on a selector from the API's context - * - * @param tableSelector Table selector. - */ - table(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TableMethods; + * Select a table based on a selector from the API's context + * + * @param tableSelector Table selector. + */ + table(tableSelector: any): TableMethods; /** - * Select all tables - */ - tables(): TablesMethods; - - /** - * Select tables based on the given selector - * - * @param tableSelector Table selector. - */ - tables(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TablesMethods; + * Select tables based on the given selector + * + * @param tableSelector Table selector. + */ + tables(tableSelector?: any): TablesMethods; //#endregion "Table/Tables" } - export interface DataTables extends CoreMethods { + interface DataTables extends CoreMethods { [index: number]: Api; } interface ObjectSelectorModifier { /** - * The order modifier provides the ability to control which order the rows are processed in. - * Values: 'current', 'applied', 'index', 'original' - */ + * The order modifier provides the ability to control which order the rows are processed in. + * Values: 'current', 'applied', 'index', 'original' + */ order?: string; /** - * The search modifier provides the ability to govern which rows are used by the selector using the search options that are applied to the table. - * Values: 'none', 'applied', 'removed' - */ + * The search modifier provides the ability to govern which rows are used by the selector using the search options that are applied to the table. + * Values: 'none', 'applied', 'removed' + */ search?: string; /** - * The searchPlaceholder modifier provides the ability to provide informational text for an input control when it has no value. - */ + * The searchPlaceholder modifier provides the ability to provide informational text for an input control when it has no value. + */ searchPlaceholder?: string; /** - * The page modifier allows you to control if the selector should consider all data in the table, regardless of paging, or if only the rows in the currently disabled page should be used. - * Values: 'all', 'current' - */ + * The page modifier allows you to control if the selector should consider all data in the table, regardless of paging, or if only the rows in the currently disabled page should be used. + * Values: 'all', 'current' + */ page?: string; } @@ -163,105 +168,102 @@ declare namespace DataTables { interface CoreMethods extends UtilityMethods { /** - * Get jquery object - */ + * Get jquery object + */ $(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery; - ///// Almost identical to $ in operation, but in this case returns the data for the matched rows. - //_(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery; - /** - * Ajax Methods - */ + * Ajax Methods + */ ajax: AjaxMethodModel; /** - * Clear the table of all data. - */ + * Clear the table of all data. + */ clear(): Api; /** - * Destroy the DataTables in the current context. - * - * @param remove Completely remove the table from the DOM (true) or leave it in the DOM in its original plain un-enhanced HTML state (default, false). - */ + * Destroy the DataTables in the current context. + * + * @param remove Completely remove the table from the DOM (true) or leave it in the DOM in its original plain un-enhanced HTML state (default, false). + */ destroy(remove?: boolean): Api; /** - * Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required. - * - * @param paging This parameter is used to determine what kind of draw DataTables will perform. - */ + * Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required. + * + * @param paging This parameter is used to determine what kind of draw DataTables will perform. + */ draw(paging?: boolean | string): Api; /* - * Look up a language token that was defined in the DataTables' language initialisation object. - * - * @param token The language token to lookup from the language object. - * @param def The default value to use if the DataTables initialisation has not specified a value. - * @param numeric If handling numeric output, the number to be presented should be given in this parameter. If not numeric operator is required (for example button label text) this parameter is not required. - * - * @returns Resulting internationalised string. - */ - i18n(token: string, def: any | string, numeric?: number): string; + * Look up a language token that was defined in the DataTables' language initialisation object. + * + * @param token The language token to lookup from the language object. + * @param def The default value to use if the DataTables initialisation has not specified a value. + * @param numeric If handling numeric output, the number to be presented should be given in this parameter. + * + * @returns Resulting internationalised string. + */ + i18n(token: string, def: any, numeric?: number): string; /* - * Get the initialisation options used for the table. Since: DataTables 1.10.6 - */ + * Get the initialisation options used for the table. Since: DataTables 1.10.6 + */ init(): Settings; /** - * Table events removal. - * - * @param event Event name to remove. - * @param callback Specific callback function to remove if you want to unbind a single event listener. - */ - off(event: string, callback?: Function): Api; + * Table events removal. + * + * @param event Event name to remove. + * @param callback Specific callback function to remove if you want to unbind a single event listener. + */ + off(event: string, callback?: ((e: Event, settings: Settings, json: any) => void)): Api; /** - * Table events listener. - * - * @param event Event to listen for. - * @param callback Specific callback function to remove if you want to unbind a single event listener. - */ - on(event: string, callback: Function): Api; + * Table events listener. + * + * @param event Event to listen for. + * @param callback Specific callback function to remove if you want to unbind a single event listener. + */ + on(event: string, callback: ((e: Event, settings: Settings, json: any) => void)): Api; /** - * Listen for a table event once and then remove the listener. - * - * @param event Event to listen for. - * @param callback Specific callback function to remove if you want to unbind a single event listener. - */ - one(event: string, callback: Function): Api; + * Listen for a table event once and then remove the listener. + * + * @param event Event to listen for. + * @param callback Specific callback function to remove if you want to unbind a single event listener. + */ + one(event: string, callback: ((e: Event, settings: Settings, json: any) => void)): Api; /** - * Page Methods / Object - */ + * Page Methods / object + */ page: PageMethods; /** - * Get current search - */ + * Get current search + */ search(): string; /** - * Search for data in the table. - * - * @param input Search string to apply to the table. - * @param regex Treat as a regular expression (true) or not (default, false). - * @param smart Perform smart search. - * @param caseInsen Do case-insensitive matching (default, true) or not (false). - */ + * Search for data in the table. + * + * @param input Search string to apply to the table. + * @param regex Treat as a regular expression (true) or not (default, false). + * @param smart Perform smart search. + * @param caseInsen Do case-insensitive matching (default, true) or not (false). + */ search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api; /** - * Obtain the table's settings object - */ + * Obtain the table's settings object + */ settings(): Api; /** - * Page Methods / Object - */ + * Page Methods / object + */ state: StateMethods; } @@ -269,43 +271,43 @@ declare namespace DataTables { interface AjaxMethods extends Api { /** - * Reload the table data from the Ajax data source. - * - * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. - * @param resetPaging Reset (default action or true) or hold the current paging position (false). - */ - load(callback?: Function, resetPaging?: boolean): Api; + * Reload the table data from the Ajax data source. + * + * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. + * @param resetPaging Reset (default action or true) or hold the current paging position (false). + */ + load(callback?: ((json: any) => void), resetPaging?: boolean): Api; } interface AjaxMethodModel { /** - * Get the latest JSON data obtained from the last Ajax request DataTables made - */ - json(): Object; + * Get the latest JSON data obtained from the last Ajax request DataTables made + */ + json(): object; /** - * Get the data submitted by DataTables to the server in the last Ajax request - */ - params(): Object; + * Get the data submitted by DataTables to the server in the last Ajax request + */ + params(): object; /** - * Reload the table data from the Ajax data source. - * - * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. - * @param resetPaging Reset (default action or true) or hold the current paging position (false). - */ - reload(callback?: Function, resetPaging?: boolean): Api; + * Reload the table data from the Ajax data source. + * + * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. + * @param resetPaging Reset (default action or true) or hold the current paging position (false). + */ + reload(callback?: ((json: any) => void), resetPaging?: boolean): Api; /** - * Reload the table data from the Ajax data source - */ + * Reload the table data from the Ajax data source + */ url(): string; /** - * Reload the table data from the Ajax data source - * - * @param url URL to set to be the Ajax data source for the table. - */ + * Reload the table data from the Ajax data source + * + * @param url URL to set to be the Ajax data source for the table. + */ url(url: string): AjaxMethods; } @@ -315,27 +317,26 @@ declare namespace DataTables { interface OrderMethods { /** - * Get the ordering applied to the table. - */ - (): (string | number)[][]; + * Get the ordering applied to the table. + */ + (): Array>; /** - * Set the ordering applied to the table. - * - * @param order Order Model - */ - (order?: (string | number)[]): Api; - (order?: (string | number)[][]): Api; - (order: (string | number)[], ...args: any[]): Api; + * Set the ordering applied to the table. + * + * @param order Order Model + */ + (order?: Array<(string | number)> | Array>): Api; + (order: Array<(string | number)>, ...args: any[]): Api; /** - * Add an ordering listener to an element, for a given column. - * - * @param node Selector - * @param column Column index - * @param callback Callback function - */ - listener(node: string | Node | JQuery, column: number, callback: Function): Api; + * Add an ordering listener to an element, for a given column. + * + * @param node Selector + * @param column Column index + * @param callback Callback function + */ + listener(node: string | Node | JQuery, column: number, callback: (() => void)): Api; } //#endregion "order-methods" @@ -343,32 +344,32 @@ declare namespace DataTables { interface PageMethods { /** - * Get the current page of the table. - */ + * Get the current page of the table. + */ (): number; /** - * Set the current page of the table. - * - * @param page Index or 'first', 'next', 'previous', 'last' - */ + * Set the current page of the table. + * + * @param page Index or 'first', 'next', 'previous', 'last' + */ (page: number | string): Api; /** - * Get paging information about the table - */ + * Get paging information about the table + */ info(): PageMethodeModelInfoReturn; /** - * Get the table's page length. - */ + * Get the table's page length. + */ len(): number; /** - * Set the table's page length. - * - * @param length Page length to set. use -1 to show all records. - */ + * Set the table's page length. + * + * @param length Page length to set. use -1 to show all records. + */ len(length: number): Api; } @@ -380,7 +381,7 @@ declare namespace DataTables { length: number; recordsTotal: number; recordsDisplay: number; - serverSide: boolean + serverSide: boolean; } //#endregion "page-methods" @@ -389,23 +390,23 @@ declare namespace DataTables { interface StateMethods { /** - * Get the last saved state of the table - */ + * Get the last saved state of the table + */ (): StateReturnModel; /** - * Clear the saved state of the table. - */ + * Clear the saved state of the table. + */ clear(): Api; /** - * Get the table state that was loaded during initialisation. - */ + * Get the table state that was loaded during initialisation. + */ loaded(): StateReturnModel; /** - * Trigger a state save. - */ + * Trigger a state save. + */ save(): Api; } @@ -413,7 +414,7 @@ declare namespace DataTables { time: number; start: number; length: number; - order: (string | number)[][]; + order: Array>; search: SearchSettings; columns: StateReturnModelColumns[]; } @@ -431,179 +432,179 @@ declare namespace DataTables { interface UtilityMethods { /* - * Get a boolean value to indicate if there are any entries in the API instance's result set (i.e. any data, selected rows, etc). - */ + * Get a boolean value to indicate if there are any entries in the API instance's result set (i.e. any data, selected rows, etc). + */ any(): boolean; /** - * Concatenate two or more API instances together - * - * @param a API instance to concatenate to the initial instance. - * @param b Additional API instance(s) to concatenate to the initial instance. - */ - concat(a: Object, ...b: Object[]): Api; + * Concatenate two or more API instances together + * + * @param a API instance to concatenate to the initial instance. + * @param b Additional API instance(s) to concatenate to the initial instance. + */ + concat(a: object, ...b: object[]): Api; /** - * Get the number of entries in an API instance's result set, regardless of multi-table grouping (e.g. any data, selected rows, etc). Since: 1.10.8 - */ + * Get the number of entries in an API instance's result set, regardless of multi-table grouping (e.g. any data, selected rows, etc). Since: 1.10.8 + */ count(): number; /** - * Iterate over the contents of the API result set. - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters - */ - each(fn: Function): Api; + * Iterate over the contents of the API result set. + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters + */ + each(fn: ((value: any, index: number, dt: Api) => void)): Api; /** - * Reduce an Api instance to a single context and result set. - * - * @param idx Index to select - */ + * Reduce an Api instance to a single context and result set. + * + * @param idx Index to select + */ eq(idx: number): Api; /** - * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass. - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. - */ - filter(fn: Function): Api; + * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass. + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. + */ + filter(fn: ((value: any, index: number, dt: Api) => boolean)): Api; /** - * Flatten a 2D array structured API instance to a 1D array structure. - */ + * Flatten a 2D array structured API instance to a 1D array structure. + */ flatten(): Api; /** - * Find the first instance of a value in the API instance's result set. - * - * @param value Value to find in the instance's result set. - */ + * Find the first instance of a value in the API instance's result set. + * + * @param value Value to find in the instance's result set. + */ indexOf(value: any): number; /** - * Join the elements in the result set into a string. - * - * @param separator The string that will be used to separate each element of the result set. - */ + * Join the elements in the result set into a string. + * + * @param separator The string that will be used to separate each element of the result set. + */ join(separator: string): string; /** - * Find the last instance of a value in the API instance's result set. - * - * @param value Value to find in the instance's result set. - */ + * Find the last instance of a value in the API instance's result set. + * + * @param value Value to find in the instance's result set. + */ lastIndexOf(value: any): number; /** - * Number of elements in an API instance's result set. - */ + * Number of elements in an API instance's result set. + */ length: number; /** - * Iterate over the result set of an API instance, creating a new API instance from the values returned by the callback. - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. - */ - map(fn: Function): Api; + * Iterate over the result set of an API instance, creating a new API instance from the values returned by the callback. + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. + */ + map(fn: ((value: any, index: number, dt: Api) => any)): Api; /** - * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements. - * - * @param property Object property name to use from the element in the original result set for the new result set. - */ + * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements. + * + * @param property object property name to use from the element in the original result set for the new result set. + */ pluck(property: number | string): Api; /** - * Remove the last item from an API instance's result set. - */ + * Remove the last item from an API instance's result set. + */ pop(): any; /** - * Add one or more items to the end of an API instance's result set. - * - * @param value_1 Item to add to the API instance's result set. - */ - push(value_1: any | any[], ...value_2: any[]): number; + * Add one or more items to the end of an API instance's result set. + * + * @param value_1 Item to add to the API instance's result set. + */ + push(value_1: any, ...value_2: any[]): number; /** - * Apply a callback function against and accumulator and each element in the Api's result set (left-to-right). - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. - * @param initialValue Value to use as the first argument of the first call to the fn callback. - */ - reduce(fn: Function, initialValue?: any): any; + * Apply a callback function against and accumulator and each element in the Api's result set (left-to-right). + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. + * @param initialValue Value to use as the first argument of the first call to the fn callback. + */ + reduce(fn: ((current: number, value: any, index: number, dt: Api) => number), initialValue?: any): any; /** - * Apply a callback function against and accumulator and each element in the Api's result set (right-to-left). - * - * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. - * @param initialValue Value to use as the first argument of the first call to the fn callback. - */ - reduceRight(fn: Function, initialValue?: any): any; + * Apply a callback function against and accumulator and each element in the Api's result set (right-to-left). + * + * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters. + * @param initialValue Value to use as the first argument of the first call to the fn callback. + */ + reduceRight(fn: ((current: number, value: any, index: number, dt: Api) => number), initialValue?: any): any; /** - * Reverse the result set of the API instance and return the original array. - */ + * Reverse the result set of the API instance and return the original array. + */ reverse(): Api; /** - * Remove the first item from an API instance's result set. - */ + * Remove the first item from an API instance's result set. + */ shift(): any; /** - * Sort the elements of the API instance's result set. - * - * @param fn This is a standard Javascript sort comparison function. It accepts two parameters. - */ - sort(fn?: Function): Api; + * Sort the elements of the API instance's result set. + * + * @param fn This is a standard Javascript sort comparison function. It accepts two parameters. + */ + sort(fn?: ((value1: any, value2: any) => number)): Api; /** - * Modify the contents of an Api instance's result set, adding or removing items from it as required. - * - * @param index Index at which to start modifying the Api instance's result set. - * @param howMany Number of elements to remove from the result set. - * @param value_1 Item to add to the result set at the index specified by the first parameter. - */ - splice(index: number, howMany: number, value_1?: any | any[], ...value_2: any[]): any[]; + * Modify the contents of an Api instance's result set, adding or removing items from it as required. + * + * @param index Index at which to start modifying the Api instance's result set. + * @param howMany Number of elements to remove from the result set. + * @param value_1 Item to add to the result set at the index specified by the first parameter. + */ + splice(index: number, howMany: number, value_1?: any, ...value_2: any[]): any[]; /** - * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. - */ + * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. + */ to$(): JQuery; /** - * Create a native Javascript array object from an API instance. - */ + * Create a native Javascript array object from an API instance. + */ toArray(): any[]; /** - * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. - */ + * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. + */ toJQuery(): JQuery; /** - * Create a new API instance containing only the unique items from a the elements in an instance's result set. - */ + * Create a new API instance containing only the unique items from a the elements in an instance's result set. + */ unique(): Api; /** - * Add one or more items to the start of an API instance's result set. - * - * @param value_1 Item to add to the API instance's result set. - */ - unshift(value_1: any | any[], ...value_2: any[]): number; + * Add one or more items to the start of an API instance's result set. + * + * @param value_1 Item to add to the API instance's result set. + */ + unshift(value_1: any, ...value_2: any[]): number; } //#endregion "util-methods" interface CommonSubMethods { /** - * Get the DataTables cached data for the selected cell - * - * @param t Specify which cache the data should be read from. Can take one of two values: search or order - */ + * Get the DataTables cached data for the selected cell + * + * @param t Specify which cache the data should be read from. Can take one of two values: search or order + */ cache(t: string): Api; } @@ -611,41 +612,41 @@ declare namespace DataTables { interface CommonCellMethods extends CommonSubMethods { /** - * Invalidate the data held in DataTables for the selected cells - * - * @param source Data source to read the new data from. - */ + * Invalidate the data held in DataTables for the selected cells + * + * @param source Data source to read the new data from. + */ invalidate(source?: string): Api; /** - * Get data for the selected cell - * - * @param f Data type to get. This can be one of: 'display', 'filter', 'sort', 'type' - */ + * Get data for the selected cell + * + * @param f Data type to get. This can be one of: 'display', 'filter', 'sort', 'type' + */ render(t: string): any; } interface CellMethods extends CoreMethods, CommonCellMethods { /** - * Get data for the selected cell - */ + * Get data for the selected cell + */ data(): any; /** - * Get data for the selected cell - * - * @param data Value to assign to the data for the cell - */ + * Get data for the selected cell + * + * @param data Value to assign to the data for the cell + */ data(data: any): Api; /** - * Get index information about the selected cell - */ + * Get index information about the selected cell + */ index(): CellIndexReturn; /** - * Get the DOM element for the selected cell - */ + * Get the DOM element for the selected cell + */ node(): Node; } @@ -657,25 +658,25 @@ declare namespace DataTables { interface CellsMethods extends CoreMethods, CommonCellMethods { /** - * Get data for the selected cells - */ + * Get data for the selected cells + */ data(): Api; /** - * Iterate over each selected cell, with the function context set to be the cell in question. Since: DataTables 1.10.6 - * - * @param fn Function to execute for every cell selected. - */ + * Iterate over each selected cell, with the function context set to be the cell in question. Since: DataTables 1.10.6 + * + * @param fn Function to execute for every cell selected. + */ every(fn: (cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api; /** - * Get index information about the selected cells - */ + * Get index information about the selected cells + */ indexes(): Api; /** - * Get the DOM elements for the selected cells - */ + * Get the DOM elements for the selected cells + */ nodes(): Api; } //#endregion "cell-methods" @@ -684,128 +685,128 @@ declare namespace DataTables { interface CommonColumnMethod extends CommonSubMethods { /** - * Get the footer th / td cell for the selected column. - */ + * Get the footer th / td cell for the selected column. + */ footer(): any; /** - * Get the header th / td cell for a column. - */ + * Get the header th / td cell for a column. + */ header(): Node; /** - * Order the table, in the direction specified, by the column selected by the column()DT selector. - * - * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending). - */ + * Order the table, in the direction specified, by the column selected by the column()DT selector. + * + * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending). + */ order(direction: string): Api; /** - * Get the visibility of the selected column. - */ + * Get the visibility of the selected column. + */ visible(): boolean; /** - * Set the visibility of the selected column. - * - * @param show Specify if the column should be visible (true) or not (false). - * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance. - */ + * Set the visibility of the selected column. + * + * @param show Specify if the column should be visible (true) or not (false). + * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false). + */ visible(show: boolean, redrawCalculations?: boolean): Api; } interface ColumnMethodsModel { /** - * Select the column found by a column selector - * - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ + * Select the column found by a column selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnMethods; /** - * Convert from the input column index type to that required. - * - * @param t The type on conversion that should take place: 'fromVisible', 'toData', 'fromData', 'toVisible' - * @param index The index to be converted - */ + * Convert from the input column index type to that required. + * + * @param t The type on conversion that should take place: 'fromVisible', 'toData', 'fromData', 'toVisible' + * @param index The index to be converted + */ index(t: string, index: number): number; } interface ColumnMethods extends CoreMethods, CommonColumnMethod { /** - * Get the data for the cells in the selected column. - */ + * Get the data for the cells in the selected column. + */ data(): Api; /** - * Get the data source property for the selected column - */ - dataSrc(): number | string | Function; + * Get the data source property for the selected column + */ + dataSrc(): number | string | (() => string); /** - * Get index information about the selected cell - * - * @param t Specify if you want to get the column data index (default) or the visible index (visible). - */ + * Get index information about the selected cell + * + * @param t Specify if you want to get the column data index (default) or the visible index (visible). + */ index(t?: string): Api; /** - * Obtain the th / td nodes for the selected column - */ + * Obtain the th / td nodes for the selected column + */ nodes(): Api[]; } interface ColumnsMethodsModel { /** - * Select all columns - * - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ + * Select all columns + * + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ (modifier?: ObjectSelectorModifier): ColumnsMethods; /** - * Select columns found by a cell selector - * - * @param cellSelector Cell selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ + * Select columns found by a cell selector + * + * @param cellSelector Cell selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnsMethods; /** - * Recalculate the column widths for layout. - */ + * Recalculate the column widths for layout. + */ adjust(): Api; } interface ColumnsMethods extends CoreMethods, CommonColumnMethod { /** - * Obtain the data for the columns from the selector - */ + * Obtain the data for the columns from the selector + */ data(): Api; /** - * Get the data source property for the selected columns. - */ + * Get the data source property for the selected columns. + */ dataSrc(): Api; /** - * Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6 - * - * @param fn Function to execute for every column selected. - */ + * Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6 + * + * @param fn Function to execute for every column selected. + */ every(fn: (colIdx: number, tableLoop: number, colLoop: number) => void): Api; /** - * Get the column indexes of the selected columns. - * - * @param t Specify if you want to get the column data index (default) or the visible index (visible). - */ + * Get the column indexes of the selected columns. + * + * @param t Specify if you want to get the column data index (default) or the visible index (visible). + */ indexes(t?: string): Api; /** - * Obtain the th / td nodes for the selected columns - */ + * Obtain the th / td nodes for the selected columns + */ nodes(): Api[][]; } //#endregion "column-methods" @@ -814,199 +815,193 @@ declare namespace DataTables { interface CommonRowMethod extends CommonSubMethods { /** - * Obtain the th / td nodes for the selected column - * - * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom' - */ + * Obtain the th / td nodes for the selected column + * + * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom' + */ invalidate(source?: string): Api; } interface RowChildMethodModel { /** - * Get the child row(s) that have been set for a parent row - */ + * Get the child row(s) that have been set for a parent row + */ (): JQuery; /** - * Get the child row(s) that have been set for a parent row - * - * @param showRemove This parameter can be given as true or false - */ + * Get the child row(s) that have been set for a parent row + * + * @param showRemove This parameter can be given as true or false + */ (showRemove: boolean): RowChildMethods; /** - * Set the data to show in the child row(s). Note that calling this method will replace any child rows which are already attached to the parent row. - * - * @param data The data to be shown in the child row can be given in multiple different ways. - * @param className Class name that is added to the td cell node(s) of the child row(s). As of 1.10.1 it is also added to the tr row node of the child row(s). - */ - (data: (string | Node | JQuery) | (string | Node | JQuery)[], className?: string): RowChildMethods; + * Set the data to show in the child row(s). Note that calling this method will replace any child rows which are already attached to the parent row. + * + * @param data The data to be shown in the child row can be given in multiple different ways. + * @param className Class name that is added to the td cell node(s) of the child row(s). As of 1.10.1 it is also added to the tr row node of the child row(s). + */ + (data: (string | Node | JQuery) | Array<(string | number | JQuery)>, className?: string): RowChildMethods; /** - * Hide the child row(s) of a parent row - */ + * Hide the child row(s) of a parent row + */ hide(): Api; /** - * Check if the child rows of a parent row are visible - */ + * Check if the child rows of a parent row are visible + */ isShown(): Api; /** - * Remove child row(s) from display and release any allocated memory - */ + * Remove child row(s) from display and release any allocated memory + */ remove(): Api; /** - * Show the child row(s) of a parent row - */ + * Show the child row(s) of a parent row + */ show(): Api; } interface RowChildMethods extends CoreMethods { /** - * Hide the child row(s) of a parent row - */ + * Hide the child row(s) of a parent row + */ hide(): Api; /** - * Remove child row(s) from display and release any allocated memory - */ + * Remove child row(s) from display and release any allocated memory + */ remove(): Api; /** - * Make newly defined child rows visible - */ + * Make newly defined child rows visible + */ show(): Api; } interface RowMethodsModel { /** - * Select a row found by a row selector - * - * @param rowSelector Row selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ + * Select a row found by a row selector + * + * @param rowSelector Row selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ (rowSelector: any, modifier?: ObjectSelectorModifier): RowMethods; /** - * Add a new row to the table using the given data - * - * @param data Data to use for the new row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table - */ - add(data: any[] | Object): Api; + * Add a new row to the table using the given data + * + * @param data Data to use for the new row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table + */ + add(data: any[] | object): Api; } interface RowMethods extends CoreMethods, CommonRowMethod { /** - * Order Methods / Object - */ + * Order Methods / object + */ child: RowChildMethodModel; /** - * Get the data for the selected row - */ - data(): any[] | Object; + * Get the data for the selected row + */ + data(): any[] | object; /** - * Set the data for the selected row - * - * @param d Data to use for the row. - */ - data(d: any[] | Object): Api; + * Set the data for the selected row + * + * @param d Data to use for the row. + */ + data(d: any[] | object): Api; /** - - * Get the id of the selected row. Since: 1.10.8 - * - * @param hash true - Append a hash (#) to the start of the row id. This can be useful for then using the id as a selector - * false - Do not modify the id value. - * @returns Row id. If the row does not have an id available 'undefined' will be returned. - */ + * Get the id of the selected row. Since: 1.10.8 + * + * @param hash true - Append a hash (#) to the start of the row id. This can be useful for then using the id as a selector + * false - Do not modify the id value. + * @returns Row id. If the row does not have an id available 'undefined' will be returned. + */ id(hash?: boolean): string; /** - * Get the row index of the row column. - */ + * Get the row index of the row column. + */ index(): number; /** - * Obtain the tr node for the selected row - */ + * Obtain the tr node for the selected row + */ node(): Node; /** - * Delete the selected row from the DataTable. - */ + * Delete the selected row from the DataTable. + */ remove(): Node; } interface RowsMethodsModel { /** - * Select all rows - * - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ + * Select all rows + * + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ (modifier?: ObjectSelectorModifier): RowsMethods; /** - * Select rows found by a row selector - * - * @param cellSelector Row selector. - * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. - */ + * Select rows found by a row selector + * + * @param cellSelector Row selector. + * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. + */ (rowSelector: any, modifier?: ObjectSelectorModifier): RowsMethods; /** - * Add new rows to the table using the data given - * - * @param data Array of data elements, with each one describing a new row to be added to the table - */ + * Add new rows to the table using the data given + * + * @param data Array of data elements, with each one describing a new row to be added to the table + */ add(data: any[]): Api; } interface RowsMethods extends CoreMethods, CommonRowMethod { /** - * Get the data for the rows from the selector - */ - data(): Api; + * Get / Set the data for the selected row + * + * @param d Data to use for the row. + */ + data(d?: any[] | object): Api; /** - * Set the data for the selected row - * - * @param d Data to use for the row. - */ - data(d: any[] | Object): Api; - - /** - * Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6 - * - * @param fn Function to execute for every row selected. - */ + * Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6 + * + * @param fn Function to execute for every row selected. + */ every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): Api; /** - * Get the ids of the selected rows. Since: 1.10.8 - * - * @param hash true - Append a hash (#) to the start of each row id. This can be useful for then using the ids as selectors - * false - Do not modify the id value. - * @returns Api instance with the selected rows in its result set. If a row does not have an id available 'undefined' will be returned as the value. - */ + * Get the ids of the selected rows. Since: 1.10.8 + * + * @param hash true - Append a hash (#) to the start of each row id. This can be useful for then using the ids as selectors + * false - Do not modify the id value. + * @returns Api instance with the selected rows in its result set. If a row does not have an id available 'undefined' will be returned as the value. + */ ids(hash?: boolean): Api; /** - * Get the row indexes of the selected rows. - */ + * Get the row indexes of the selected rows. + */ indexes(): Api; /** - * Obtain the tr nodes for the selected rows - */ + * Obtain the tr nodes for the selected rows + */ nodes(): Api; /** - * Delete the selected rows from the DataTable. - */ + * Delete the selected rows from the DataTable. + */ remove(): Api; } //#endregion "row-methods" @@ -1015,55 +1010,55 @@ declare namespace DataTables { interface TableMethods extends CoreMethods { /** - * Get the tfoot node for the table in the API's context - */ + * Get the tfoot node for the table in the API's context + */ footer(): Node; /** - * Get the thead node for the table in the API's context - */ + * Get the thead node for the table in the API's context + */ header(): Node; /** - * Get the tbody node for the table in the API's context - */ + * Get the tbody node for the table in the API's context + */ body(): Node; /** - * Get the div container node for the table in the API's context - */ + * Get the div container node for the table in the API's context + */ container(): Node; /** - * Get the table node for the table in the API's context - */ + * Get the table node for the table in the API's context + */ node(): Node; } interface TablesMethods extends CoreMethods { /** - * Get the tfoot nodes for the tables in the API's context - */ + * Get the tfoot nodes for the tables in the API's context + */ footer(): Api; /** - * Get the thead nodes for the tables in the API's context - */ + * Get the thead nodes for the tables in the API's context + */ header(): Api; /** - * Get the tbody nodes for the tables in the API's context - */ + * Get the tbody nodes for the tables in the API's context + */ body(): Api; /** - * Get the div container nodes for the tables in the API's context - */ + * Get the div container nodes for the tables in the API's context + */ containers(): Api; /** - * Get the table nodes for the tables in the API's context - */ + * Get the table nodes for the tables in the API's context + */ nodes(): Api; } //#endregion "table-methods" @@ -1072,142 +1067,165 @@ declare namespace DataTables { //#region "Static-Methods" - export interface StaticFunctions { + interface StaticFunctions { /** - * Check is a table node is a DataTable or not - * - * @param table Selector string for table - */ + * Returns JQuery object + * + * Usage: + * $( selector ).dataTable(); + */ + (): JQueryDataTables; + + /** + * Check is a table node is a DataTable or not + * + * Usage: + * $.fn.dataTable.isDataTable("selector"); + * @param table Selector string for table + */ isDataTable(table: string): boolean; /** - * Get all DataTable tables that have been initialised - optionally you can select to get only currently visible tables and / or retrieve the tables as API instances. - * - * @param visible As a boolean value this options is used to indicate if you want all tables on the page should be returned (false), or visible tables only (true). - * Since 1.10.8 this option can also be given as an object. - */ - tables(visible?: boolean | ObjectTablesStatic): DataTables.Api[] | DataTables.Api; + * Get all DataTable tables that have been initialised - optionally you can select to get only currently visible tables and / or retrieve the tables as API instances. + * + * @param visible As a boolean value this options is used to indicate if you want all tables on the page should be returned (false), or visible tables only (true). + * Since 1.10.8 this option can also be given as an object. + */ + tables(visible?: boolean | objectTablesStatic): Api[] | Api; /** - * Version number compatibility check function - * - * @param version Version string - */ + * Version number compatibility check function + * + * Usage: + * $.fn.dataTable.versionCheck("1.10.0"); + * @param version Version string + */ versionCheck(version: string): boolean; /** - * Utils - */ + * Utils + */ util: StaticUtilFunctions; /** - * Check is a table node is a DataTable or not - * - * @param table Selector string for table - */ - Api(selector: string | Node | Node[] | JQuery): DataTables.Api; + * Get DataTable API instance + * + * @param table Selector string for table + */ + Api: new (selector: string | Node | Node[] | JQuery) => Api; + + /** + * Default Settings + */ + defaults: Settings; + + /** + * Default Settings + */ + ext: ExtSettings; } - export interface StaticUtilFunctions { + interface StaticUtilFunctions { /** - * Escape special characters in a regular expression string. Since: 1.10.4 - * - * @param str String to escape - */ + * Escape special characters in a regular expression string. Since: 1.10.4 + * + * @param str String to escape + */ escapeRegex(str: string): string; /** - * Throttle the calls to a method to reduce call frequency. Since: 1.10.3 - * - * @param fn Function - * @param period ms - */ - throttle(fn: Function, period?: number): Function; + * Throttle the calls to a method to reduce call frequency. Since: 1.10.3 + * + * @param fn Function + * @param period ms + */ + throttle(fn: FunctionThrottle, period?: number): (() => void); } - interface ObjectTablesStatic { + type FunctionThrottle = (data: any) => void; + + interface objectTablesStatic { /** - * Get only visible tables (true) or all tables regardless of visibility (false). - */ - visible: boolean + * Get only visible tables (true) or all tables regardless of visibility (false). + */ + visible: boolean; /** - * Return a DataTables API instance for the selected tables (true) or an array (false). - */ - api: boolean + * Return a DataTables API instance for the selected tables (true) or an array (false). + */ + api: boolean; } //#endregion "Static-Methods" //#region "Settings" - export interface Settings { - + interface Settings { //#region "Features" /** - * Feature control DataTables' smart column width handling. Since: 1.10 - */ + * Feature control DataTables' smart column width handling. Since: 1.10 + */ autoWidth?: boolean; /** - * Feature control deferred rendering for additional speed of initialisation. Since: 1.10 - */ + * Feature control deferred rendering for additional speed of initialisation. Since: 1.10 + */ deferRender?: boolean; /** - * Feature control table information display field. Since: 1.10 - */ + * Feature control table information display field. Since: 1.10 + */ info?: boolean; /** - * Use markup and classes for the table to be themed by jQuery UI ThemeRoller. Since: 1.10 - */ + * Use markup and classes for the table to be themed by jQuery UI ThemeRoller. Since: 1.10 + */ jQueryUI?: boolean; /** - * Feature control the end user's ability to change the paging display length of the table. Since: 1.10 - */ + * Feature control the end user's ability to change the paging display length of the table. Since: 1.10 + */ lengthChange?: boolean; /** - * Feature control ordering (sorting) abilities in DataTables. Since: 1.10 - */ + * Feature control ordering (sorting) abilities in DataTables. Since: 1.10 + */ ordering?: boolean; /** - * Enable or disable table pagination. Since: 1.10 - */ + * Enable or disable table pagination. Since: 1.10 + */ paging?: boolean; /** - * Feature control the processing indicator. Since: 1.10 - */ + * Feature control the processing indicator. Since: 1.10 + */ processing?: boolean; /** - * Horizontal scrolling. Since: 1.10 - */ + * Horizontal scrolling. Since: 1.10 + */ scrollX?: boolean; /** - * Vertical scrolling. Since: 1.10 Exp: "200px" - */ + * Vertical scrolling. Since: 1.10 Exp: "200px" + */ scrollY?: string; /** - * Feature control search (filtering) abilities Since: 1.10 - */ + * Feature control search (filtering) abilities Since: 1.10 + */ searching?: boolean; /** - * Feature control DataTables' server-side processing mode. Since: 1.10 - */ + * Feature control DataTables' server-side processing mode. Since: 1.10 + */ serverSide?: boolean; /** - * State saving - restore table state on page reload. Since: 1.10 - */ + * State saving - restore table state on page reload. Since: 1.10 + */ stateSave?: boolean; //#endregion "Features" @@ -1215,142 +1233,142 @@ declare namespace DataTables { //#region "Data" /** - * Load data for the table's content from an Ajax source. Since: 1.10 - */ + * Load data for the table's content from an Ajax source. Since: 1.10 + */ ajax?: string | AjaxSettings | FunctionAjax; /** - * Data to use as the display data for the table. Since: 1.10 - */ - data?: Object; + * Data to use as the display data for the table. Since: 1.10 + */ + data?: object; //#endregion "Data" //#region "Options" /** - * Data to use as the display data for the table. Since: 1.10 - */ + * Data to use as the display data for the table. Since: 1.10 + */ columns?: ColumnSettings[]; /** - * Assign a column definition to one or more columns.. Since: 1.10 - */ + * Assign a column definition to one or more columns.. Since: 1.10 + */ columnDefs?: ColumnDefsSettings[]; /** - * Delay the loading of server-side data until second draw - */ + * Delay the loading of server-side data until second draw + */ deferLoading?: number | number[]; /** - * Destroy any existing table matching the selector and replace with the new options. Since: 1.10 - */ + * Destroy any existing table matching the selector and replace with the new options. Since: 1.10 + */ destroy?: boolean; /** - * Initial paging start point. Since: 1.10 - */ + * Initial paging start point. Since: 1.10 + */ displayStart?: number; /** - * Define the table control elements to appear on the page and in what order. Since: 1.10 - */ + * Define the table control elements to appear on the page and in what order. Since: 1.10 + */ dom?: string; /** - * Change the options in the page length select list. Since: 1.10 - */ - lengthMenu?: (number | string)[] | (number | string)[][]; + * Change the options in the page length select list. Since: 1.10 + */ + lengthMenu?: Array<(number | string)> | Array>; /** - * Control which cell the order event handler will be applied to in a column. Since: 1.10 - */ + * Control which cell the order event handler will be applied to in a column. Since: 1.10 + */ orderCellsTop?: boolean; /** - * Highlight the columns being ordered in the table's body. Since: 1.10 - */ + * Highlight the columns being ordered in the table's body. Since: 1.10 + */ orderClasses?: boolean; /** - * Initial order (sort) to apply to the table. Since: 1.10 - */ - order?: (string | number)[] | (string | number)[][]; + * Initial order (sort) to apply to the table. Since: 1.10 + */ + order?: Array<(number | string)> | Array>; /** - * Ordering to always be applied to the table. Since: 1.10 - */ - orderFixed?: (string | number)[] | (string | number)[][] | Object; + * Ordering to always be applied to the table. Since: 1.10 + */ + orderFixed?: Array<(number | string)> | Array> | object; /** - * Multiple column ordering ability control. Since: 1.10 - */ + * Multiple column ordering ability control. Since: 1.10 + */ orderMulti?: boolean; /** - * Change the initial page length (number of rows per page). Since: 1.10 - */ + * Change the initial page length (number of rows per page). Since: 1.10 + */ pageLength?: number; /** - * Pagination button display options. Basic Types: numbers (1.10.8) simple, simple_numbers, full, full_numbers - */ + * Pagination button display options. Basic Types: numbers (1.10.8) simple, simple_numbers, full, full_numbers + */ pagingType?: string; /** - * Retrieve an existing DataTables instance. Since: 1.10 - */ - retrieve?: boolean + * Retrieve an existing DataTables instance. Since: 1.10 + */ + retrieve?: boolean; /** - * Display component renderer types. Since: 1.10 - */ + * Display component renderer types. Since: 1.10 + */ renderer?: string | RendererSettings; /** - * Data property name that DataTables will use to set element DOM IDs. Since: 1.10.8 - */ + * Data property name that DataTables will use to set element DOM IDs. Since: 1.10.8 + */ rowId?: string; /** - * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10 - */ + * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10 + */ scrollCollapse?: boolean; /** - * Set an initial filter in DataTables and / or filtering options. Since: 1.10 - */ + * Set an initial filter in DataTables and / or filtering options. Since: 1.10 + */ search?: SearchSettings | boolean; /** - * Set placeholder attribute for input type="text" tag elements. Since: 1.10 - */ + * Set placeholder attribute for input type="text" tag elements. Since: 1.10 + */ searchPlaceholder?: SearchSettings; /** - * Define an initial search for individual columns. Since: 1.10 - */ + * Define an initial search for individual columns. Since: 1.10 + */ searchCols?: SearchSettings[]; /** - * Set a throttle frequency for searching. Since: 1.10 - */ + * Set a throttle frequency for searching. Since: 1.10 + */ searchDelay?: number; /** - * Saved state validity duration. Since: 1.10 - */ + * Saved state validity duration. Since: 1.10 + */ stateDuration?: number; /** - * Set the zebra stripe class names for the rows in the table. Since: 1.10 - */ + * Set the zebra stripe class names for the rows in the table. Since: 1.10 + */ stripeClasses?: string[]; /** - * Tab index control for keyboard navigation. Since: 1.10 - */ + * Tab index control for keyboard navigation. Since: 1.10 + */ tabIndex?: number; //#endregion "Options" @@ -1358,73 +1376,73 @@ declare namespace DataTables { //#region "Callbacks" /** - * Callback for whenever a TR element is created for the table's body. Since: 1.10 - */ + * Callback for whenever a TR element is created for the table's body. Since: 1.10 + */ createdRow?: FunctionCreateRow; /** - * Function that is called every time DataTables performs a draw. Since: 1.10 - */ + * Function that is called every time DataTables performs a draw. Since: 1.10 + */ drawCallback?: FunctionDrawCallback; /** - * Footer display callback function. Since: 1.10 - */ + * Footer display callback function. Since: 1.10 + */ footerCallback?: FunctionFooterCallback; /** - * Number formatting callback function. Since: 1.10 - */ + * Number formatting callback function. Since: 1.10 + */ formatNumber?: FunctionFormatNumber; /** - * Header display callback function. Since: 1.10 - */ + * Header display callback function. Since: 1.10 + */ headerCallback?: FunctionHeaderCallback; /** - * Table summary information display callback. Since: 1.10 - */ + * Table summary information display callback. Since: 1.10 + */ infoCallback?: FunctionInfoCallback; /** - * Initialisation complete callback. Since: 1.10 - */ + * Initialisation complete callback. Since: 1.10 + */ initComplete?: FunctionInitComplete; /** - * Pre-draw callback. Since: 1.10 - */ + * Pre-draw callback. Since: 1.10 + */ preDrawCallback?: FunctionPreDrawCallback; /** - * Row draw callback.. Since: 1.10 - */ + * Row draw callback.. Since: 1.10 + */ rowCallback?: FunctionRowCallback; /** - * Callback that defines where and how a saved state should be loaded. Since: 1.10 - */ + * Callback that defines where and how a saved state should be loaded. Since: 1.10 + */ stateLoadCallback?: FunctionStateLoadCallback; /** - * State loaded callback. Since: 1.10 - */ + * State loaded callback. Since: 1.10 + */ stateLoaded?: FunctionStateLoaded; /** - * State loaded - data manipulation callback. Since: 1.10 - */ + * State loaded - data manipulation callback. Since: 1.10 + */ stateLoadParams?: FunctionStateLoadParams; /** - * Callback that defines how the table state is stored and where. Since: 1.10 - */ + * Callback that defines how the table state is stored and where. Since: 1.10 + */ stateSaveCallback?: FunctionStateSaveCallback; /** - * State save - data manipulation callback. Since: 1.10 - */ + * State save - data manipulation callback. Since: 1.10 + */ stateSaveParams?: FunctionStateSaveParams; //#endregion "Callbacks" @@ -1438,7 +1456,7 @@ declare namespace DataTables { //#region "ajax-settings" - export interface AjaxDataRequest { + interface AjaxDataRequest { draw: number; start: number; length: number; @@ -1448,17 +1466,17 @@ declare namespace DataTables { search: AjaxDataRequestSearch; } - export interface AjaxDataRequestSearch { + interface AjaxDataRequestSearch { value: string; regex: boolean; } - export interface AjaxDataRequestOrder { + interface AjaxDataRequestOrder { column: number; dir: string; } - export interface AjaxDataRequestColumn { + interface AjaxDataRequestColumn { data: string | number; name: string; searchable: boolean; @@ -1466,7 +1484,7 @@ declare namespace DataTables { search: AjaxDataRequestSearch; } - export interface AjaxData { + interface AjaxData { draw?: number; recordsTotal?: number; recordsFiltered?: number; @@ -1476,126 +1494,116 @@ declare namespace DataTables { interface AjaxSettings extends JQueryAjaxSettings { /** - * Add or modify data submitted to the server upon an Ajax request. Since: 1.10 - */ - data?: Object | FunctionAjaxData; + * Add or modify data submitted to the server upon an Ajax request. Since: 1.10 + */ + data?: object | FunctionAjaxData; /** - * Data property or manipulation method for table data. Since: 1.10 - */ - dataSrc?: string | Function; + * Data property or manipulation method for table data. Since: 1.10 + */ + dataSrc?: string | ((data: any) => any[]); } - interface FunctionAjax { - (data: Object, callback: Function, settings: SettingsLegacy): void; - } + type FunctionAjax = (data: object, callback: ((data: any) => void), settings: SettingsLegacy) => void; - interface FunctionAjaxData { - /* - * @param data Data that DataTables has constructed for the request. - * @param settings DataTables settings object. Since 1.10.6 - */ - (data: Object, settings: Settings): string | Object; - } + type FunctionAjaxData = (data: object, settings: Settings) => string | object; //#endregion "ajax-settings" //#region "colunm-settings" - export interface ColumnSettings { + interface ColumnSettings { /** - * Cell type to be created for a column. th/td Since: 1.10 - */ + * Cell type to be created for a column. th/td Since: 1.10 + */ cellType?: string; /** - * Class to assign to each cell in the column. Since: 1.10 - */ + * Class to assign to each cell in the column. Since: 1.10 + */ className?: string; /** - * Add padding to the text content used when calculating the optimal with for a table. Since: 1.10 - */ + * Add padding to the text content used when calculating the optimal with for a table. Since: 1.10 + */ contentPadding?: string; /** - * Cell created callback to allow DOM manipulation. Since: 1.10 - */ + * Cell created callback to allow DOM manipulation. Since: 1.10 + */ createdCell?: FunctionColumnCreatedCell; /** - * Class to assign to each cell in the column. Since: 1.10 - */ + * Class to assign to each cell in the column. Since: 1.10 + */ data?: number | string | ObjectColumnData | FunctionColumnData; /** - * Set default, static, content for a column. Since: 1.10 - */ + * Set default, static, content for a column. Since: 1.10 + */ defaultContent?: string; /** - * Set a descriptive name for a column. Since: 1.10 - */ + * Set a descriptive name for a column. Since: 1.10 + */ name?: string; /** - * Enable or disable ordering on this column. Since: 1.10 - */ + * Enable or disable ordering on this column. Since: 1.10 + */ orderable?: boolean; /** - * Define multiple column ordering as the default order for a column. Since: 1.10 - */ + * Define multiple column ordering as the default order for a column. Since: 1.10 + */ orderData?: number | number[]; /** - * Live DOM sorting type assignment. Since: 1.10 - */ + * Live DOM sorting type assignment. Since: 1.10 + */ orderDataType?: string; /** - * Order direction application sequence. Since: 1.10 - */ + * Order direction application sequence. Since: 1.10 + */ orderSequence?: string[]; /** - * Render (process) the data for use in the table. Since: 1.10 - */ - render?: number | string | ObjectColumnRender | FunctionColumnRender; + * Render (process) the data for use in the table. Since: 1.10 + */ + render?: number | string | ObjectColumnData | FunctionColumnRender; /** - * Enable or disable filtering on the data in this column. Since: 1.10 - */ + * Enable or disable filtering on the data in this column. Since: 1.10 + */ searchable?: boolean; /** - * Set the column title. Since: 1.10 - */ + * Set the column title. Since: 1.10 + */ title?: string; /** - * Set the column type - used for filtering and sorting string processing. Since: 1.10 - */ + * Set the column type - used for filtering and sorting string processing. Since: 1.10 + */ type?: string; /** - * Enable or disable the display of this column. Since: 1.10 - */ + * Enable or disable the display of this column. Since: 1.10 + */ visible?: boolean; /** - * Column width assignment. Since: 1.10 - */ + * Column width assignment. Since: 1.10 + */ width?: string; } interface ColumnDefsSettings extends ColumnSettings { - targets: string | number | (number | string)[] + targets: string | number | Array<(number | string)>; } - interface FunctionColumnCreatedCell { - (cell: Node, cellData: any, rowData: any, row: number, col: number): void; - } + type FunctionColumnCreatedCell = (cell: Node, cellData: any, rowData: any, row: number, col: number) => void; interface FunctionColumnData { (row: any, t: 'set', s: any, meta: CellMetaSettings): void; @@ -1610,52 +1618,47 @@ declare namespace DataTables { sort?: string; } - interface ObjectColumnRender extends ObjectColumnData { - } - - interface FunctionColumnRender { - (data: any, type: 'filter' | 'display' | 'type' | 'sort' | undefined | any, row: any, meta: CellMetaSettings): any; - } + type FunctionColumnRender = (data: any, type: any, row: any, meta: CellMetaSettings) => any; interface CellMetaSettings { row: number; col: number; - settings: DataTables.Settings; + settings: Settings; } //#endregion "colunm-settings" //#region "other-settings" - export interface RendererSettings { + interface RendererSettings { header?: string; pageButton?: string; } - export interface SearchSettings { + interface SearchSettings { /** - * Control case-sensitive filtering option. Since: 1.10 - */ + * Control case-sensitive filtering option. Since: 1.10 + */ caseInsensitive?: boolean; /** - * Enable / disable escaping of regular expression characters in the search term. Since: 1.10 - */ + * Enable / disable escaping of regular expression characters in the search term. Since: 1.10 + */ regex?: boolean; /** - * Enable / disable DataTables' smart filtering. Since: 1.10 - */ + * Enable / disable DataTables' smart filtering. Since: 1.10 + */ smart?: boolean; /** - * Set an initial filtering condition on the table. Since: 1.10 - */ + * Set an initial filtering condition on the table. Since: 1.10 + */ search?: string; /** - * Set a placeholder attribute for input type="text" tag elements. Since: 1.10.1 - */ + * Set a placeholder attribute for input type="text" tag elements. Since: 1.10.1 + */ searchPlaceholder?: string; } @@ -1663,61 +1666,33 @@ declare namespace DataTables { //#region "callback-functions" - interface FunctionCreateRow { - (row: Node, data: any[] | Object, dataIndex: number): void; - } + type FunctionCreateRow = (row: Node, data: any[] | object, dataIndex: number) => void; - interface FunctionDrawCallback { - (settings: SettingsLegacy): void; - } + type FunctionDrawCallback = (settings: SettingsLegacy) => void; - interface FunctionFooterCallback { - (tfoot: Node, data: any[], start: number, end: number, display: any[]): void; - } + type FunctionFooterCallback = (tfoot: Node, data: any[], start: number, end: number, display: any[]) => void; - interface FunctionFormatNumber { - (formatNumber: number): void; - } + type FunctionFormatNumber = (formatNumber: number) => void; - interface FunctionHeaderCallback { - (thead: Node, data: any[], start: number, end: number, display: any[]): void; - } + type FunctionHeaderCallback = (thead: Node, data: any[], start: number, end: number, display: any[]) => void; - interface FunctionInfoCallback { - (settings: SettingsLegacy, start: number, end: number, mnax: number, total: number, pre: string): void; - } + type FunctionInfoCallback = (settings: SettingsLegacy, start: number, end: number, mnax: number, total: number, pre: string) => void; - interface FunctionInitComplete { - (settings: SettingsLegacy, json: Object): void; - } + type FunctionInitComplete = (settings: SettingsLegacy, json: object) => void; - interface FunctionPreDrawCallback { - (settings: SettingsLegacy): void; - } + type FunctionPreDrawCallback = (settings: SettingsLegacy) => void; - interface FunctionRowCallback { - (row: Node, data: any[] | Object, index: number): void; - } + type FunctionRowCallback = (row: Node, data: any[] | object, index: number) => void; - interface FunctionStateLoadCallback { - (settings: SettingsLegacy): void; - } + type FunctionStateLoadCallback = (settings: SettingsLegacy) => void; - interface FunctionStateLoaded { - (settings: SettingsLegacy, data: Object): void; - } + type FunctionStateLoaded = (settings: SettingsLegacy, data: object) => void; - interface FunctionStateLoadParams { - (settings: SettingsLegacy, data: Object): void; - } + type FunctionStateLoadParams = (settings: SettingsLegacy, data: object) => void; - interface FunctionStateSaveCallback { - (settings: SettingsLegacy, data: Object): void; - } + type FunctionStateSaveCallback = (settings: SettingsLegacy, data: object) => void; - interface FunctionStateSaveParams { - (settings: SettingsLegacy, data: Object): void; - } + type FunctionStateSaveParams = (settings: SettingsLegacy, data: object) => void; //#endregion "callback-functions" @@ -1764,7 +1739,7 @@ declare namespace DataTables { [index: string]: Node; } - export interface SettingsLegacy { + interface SettingsLegacy { ajax: any; oApi: any; oFeatures: FeaturesLegacy; @@ -1838,25 +1813,25 @@ declare namespace DataTables { bSortCellsTop: boolean; oInit: any; aoDestroyCallback: any[]; - fnRecordsTotal: () => number; - fnRecordsDisplay: () => number; - fnDisplayEnd: () => number; + fnRecordsTotal(): number; + fnRecordsDisplay(): number; + fnDisplayEnd(): number; oInstance: any; sInstance: string; iTabIndex: number; nScrollHead: Node; nScrollFoot: Node; - rowIdFn: (mSource: string | number | Function) => Function; + rowIdFn(mSource: string | number | (() => void)): (() => void); } - export interface BrowserLegacy { - barWidth: number, - bBounding: boolean, - bScrollbarLeft: boolean, - bScrollOversize: boolean + interface BrowserLegacy { + barWidth: number; + bBounding: boolean; + bScrollbarLeft: boolean; + bScrollOversize: boolean; } - export interface FeaturesLegacy { + interface FeaturesLegacy { bAutoWidth: boolean; bDeferRender: boolean; bFilter: boolean; @@ -1870,7 +1845,7 @@ declare namespace DataTables { bStateSave: boolean; } - export interface ScrollingLegacy { + interface ScrollingLegacy { bAutoCss: boolean; bCollapse: boolean; bInfinite: boolean; @@ -1880,7 +1855,7 @@ declare namespace DataTables { sY: string; } - export interface RowLegacy { + interface RowLegacy { nTr: Node; _aData: any; _aSortData: any[]; @@ -1888,7 +1863,7 @@ declare namespace DataTables { _sRowStripe: string; } - export interface ColumnLegacy { + interface ColumnLegacy { aDataSort: any; asSorting: string[]; bSearchable: boolean; @@ -1896,8 +1871,8 @@ declare namespace DataTables { bVisible: boolean; _bAutoType: boolean; fnCreatedCell: FunctionColumnCreatedCell; - fnGetData: (data: any, specific: string) => any; - fnSetData: (data: any, value: any) => void; + fnGetData(data: any, specific: string): any; + fnSetData(data: any, value: any): void; mData: any; mRender: any; nTh: Node; @@ -1915,11 +1890,9 @@ declare namespace DataTables { sWidthOrig: string; } - export interface CookieCallbackLegacy { - (name: string, data: any, expires: string, path: string, cookie: string): void; - } + type CookieCallbackLegacy = (name: string, data: any, expires: string, path: string, cookie: string) => void; - export interface LanguageLegacy { + interface LanguageLegacy { oAria?: LanguageAriaLegacy; oPaginate?: LanguagePaginateLegacy; sEmptyTable?: string; @@ -1936,12 +1909,12 @@ declare namespace DataTables { sZeroRecords?: string; } - export interface LanguageAriaLegacy { + interface LanguageAriaLegacy { sSortAscending?: string; sSortDescending?: string; } - export interface LanguagePaginateLegacy { + interface LanguagePaginateLegacy { sFirst?: string; sLast?: string; sNext?: string; @@ -1949,4 +1922,213 @@ declare namespace DataTables { } //#endregion "SettingsLegacy" + //#region "ext internal" + + interface ExtSettings { + aTypes: any[]; + afnFiltering: any[]; + afnSortData: object; + aoFeatures: any[]; + builder: string; + classes: ExtClassesSettings; + errMode: string; + feature: any[]; + fnVersionCheck(version: string): string; + iApiIndex: number; + internal: object; + legacy: object; + oApi: object; + oJUIClasses: object; + oPagination: object; + oSort: object; + oStdClasses: ExtClassesSettings; + ofnSearch: object; + order: object; + pager: object; + renderer: object; + sVersion: string; + search: any[]; + selector: object; + type: object; + } + + interface ExtClassesSettings { + /** + * Default Value: + * dataTable + */ + sTable?: string; + + /** + * Default Value: + * no-footer + */ + sNoFooter?: string; + + /** + * Default Value: + * paginate_button + */ + sPageButton?: string; + + /** + * Default Value: + * current + */ + sPageButtonActive?: string; + + /** + * Default Value: + * disabled + */ + sPageButtonDisabled?: string; + + /** + * Default Value: + * odd + */ + sStripeOdd?: string; + + /** + * Default Value: + * even + */ + sStripeEven?: string; + + /** + * Default Value: + * dataTables_empty + */ + sRowEmpty?: string; + + /** + * Default Value: + * dataTables_wrapper + */ + sWrapper?: string; + + /** + * Default Value: + * dataTables_filter + */ + sFilter?: string; + + /** + * Default Value: + * dataTables_info + */ + sInfo?: string; + + /** + * Default Value: + * dataTables_paginate paging_ + */ + sPaging?: string; + + /** + * Default Value: + * dataTables_length + */ + sLength?: string; + + /** + * Default Value: + * dataTables_processing + */ + sProcessing?: string; + + /** + * Default Value: + * sorting_asc + */ + sSortAsc?: string; + + /** + * Default Value: + * sorting_desc + */ + sSortDesc?: string; + + /** + * Default Value: + * sorting + */ + sSortable?: string; + + /** + * Default Value: + * sorting_asc_disabled + */ + sSortableAsc?: string; + + /** + * Default Value: + * sorting_desc_disabled + */ + sSortableDesc?: string; + + /** + * Default Value: + * sorting_disabled + */ + sSortableNone?: string; + + /** + * Default Value: + * sorting_ + */ + sSortColumn?: string; + + sFilterInput?: string; + sLengthSelect?: string; + + /** + * Default Value: + * dataTables_scroll + */ + sScrollWrapper?: string; + + /** + * Default Value: + * dataTables_scrollHead + */ + sScrollHead?: string; + + /** + * Default Value: + * dataTables_scrollHeadInner + */ + sScrollHeadInner?: string; + + /** + * Default Value: + * dataTables_scrollBody + */ + sScrollBody?: string; + + /** + * Default Value: + * dataTables_scrollFoot + */ + sScrollFoot?: string; + + /** + * Default Value: + * dataTables_scrollFootInner + */ + sScrollFootInner?: string; + + sHeaderTH?: string; + sFooterTH?: string; + sSortJUIAsc?: string; + sSortJUIDesc?: string; + sSortJUI?: string; + sSortJUIAscAllowed?: string; + sSortJUIDescAllowed?: string; + sSortJUIWrapper?: string; + sSortIcon?: string; + sJUIHeader?: string; + sJUIFooter?: string; + } + //#endregion "ext internal" } diff --git a/types/datatables.net/tslint.json b/types/datatables.net/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/datatables.net/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }