datatables.net 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types/types.d.ts CHANGED
@@ -1,19 +1,91 @@
1
1
  // Type definitions for DataTables
2
+ //
2
3
  // Project: https://datatables.net
3
- // Definitions by: SpryMedia
4
- // Kiarash Ghiaseddin <https://github.com/Silver-Connection>
5
- // Omid Rad <https://github.com/omidkrad>
6
- // Armin Sander <https://github.com/pragmatrix>
7
- // Craig Boland <https://github.com/CNBoland>
8
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
9
- // TypeScript Version: 2.4
10
-
11
- // missing:
12
- // - Some return types are not fully working
4
+ // Definitions by:
5
+ // SpryMedia
6
+ // Kiarash Ghiaseddin <https://github.com/Silver-Connection>
7
+ // Omid Rad <https://github.com/omidkrad>
8
+ // Armin Sander <https://github.com/pragmatrix>
9
+ // Craig Boland <https://github.com/CNBoland>
13
10
 
14
11
  /// <reference types="jquery" />
15
12
 
16
- // Extend the jQuery object with DataTables' construction methods
13
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
14
+ * Types
15
+ */
16
+ // No publicly documented properties
17
+ type InternalSettings = Object;
18
+
19
+ export type DomSelector =
20
+ string |
21
+ Node |
22
+ JQuery;
23
+
24
+ export type InstSelector =
25
+ DomSelector |
26
+ InternalSettings;
27
+
28
+ export type RowIdx = number;
29
+ export type RowSelector<T> =
30
+ RowIdx |
31
+ string |
32
+ Node |
33
+ JQuery |
34
+ ((idx: RowIdx, data: T, node: Node | null) => boolean) |
35
+ RowSelector<T>[];
36
+
37
+ export type ColumnIdx = number;
38
+ export type ColumnSelector =
39
+ ColumnIdx |
40
+ string |
41
+ Node |
42
+ JQuery |
43
+ ((idx:ColumnIdx, data: any, node: Node) => boolean) |
44
+ ColumnSelector[];
45
+
46
+ export type CellIdx = {
47
+ row: number;
48
+ column: number;
49
+ };
50
+ export type CellSelector =
51
+ CellIdx |
52
+ string |
53
+ Node |
54
+ JQuery |
55
+ ((idx: CellIdx, data: any, node: Node | null) => boolean) |
56
+ CellSelector[];
57
+
58
+
59
+ export type CellIdxWithVisible = {
60
+ row: number;
61
+ column: number;
62
+ columnVisible: number;
63
+ }
64
+
65
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
66
+ * Main interfaces
67
+ */
68
+
69
+ /**
70
+ * DataTables class
71
+ */
72
+ declare interface DataTables<T> extends ApiStatic {
73
+ /**
74
+ * Create a new DataTable
75
+ * @param selector Selector to pick one or more `<table>` elements
76
+ * @param opts Configuration settings
77
+ */
78
+ new <T=any>(
79
+ selector: InstSelector,
80
+ opts?: Config
81
+ ): Api<T>
82
+ }
83
+
84
+ declare const DataTables: DataTables<any>;
85
+ export default DataTables;
86
+
87
+ // The `$().dataTable()` method adds a `.api()` method to the object
88
+ // to allow access to the DataTables API
17
89
  interface JQueryDataTables extends JQuery {
18
90
  /**
19
91
  * Returns DataTables API instance
@@ -23,2703 +95,2495 @@ interface JQueryDataTables extends JQuery {
23
95
  api(): Api<any>;
24
96
  }
25
97
 
98
+ // Extend the jQuery object with DataTables' construction methods
26
99
  declare global {
27
- interface jQueryDataTable extends DataTables.StaticFunctions {
28
- (opts?: DataTables.Settings): JQueryDataTables;
29
- }
30
-
31
100
  interface JQuery {
32
- DataTable<T = any>(opts?: DataTables.Settings): DataTables.Api<T>;
33
- dataTable: jQueryDataTable;
34
- }
35
- }
36
-
37
- /**
38
- * DataTables API class object (recursive)
39
- */
40
- declare interface Api<T> extends DataTables.StaticFunctions {
41
- new <T=any>(opts?: DataTables.Settings): DataTables.Api<T>
42
- }
43
-
44
- declare const Api: Api<any>;
45
- export default Api;
46
-
47
- declare namespace DataTables {
48
- type RowIdx = number;
49
- type RowSelector<T> =
50
- RowIdx |
51
- string |
52
- Node |
53
- JQuery |
54
- ((idx: RowIdx, data: T, node: Node | null) => boolean) |
55
- RowSelector<T>[];
56
-
57
- type ColumnIdx = number;
58
- type ColumnSelector =
59
- ColumnIdx |
60
- string |
61
- Node |
62
- JQuery |
63
- ((idx:ColumnIdx, data: any, node: Node) => boolean) |
64
- ColumnSelector[];
65
-
66
- type CellIdx = {
67
- row: number;
68
- column: number;
69
- };
70
- type CellSelector =
71
- CellIdx |
72
- string |
73
- Node |
74
- JQuery |
75
- ((idx: CellIdx, data: any, node: Node | null) => boolean) |
76
- CellSelector[];
77
-
78
- interface Api<T> extends CoreMethods<T>, APIPlugIns {
79
- /**
80
- * API should be array-like
81
- */
82
- [key: number]: any;
83
101
  /**
84
- * Returns DataTables API instance
85
- *
86
- * @param table Selector string for table
102
+ * Create a new DataTable, returning a DataTables API instance.
103
+ * @param opts Configuration settings
87
104
  */
88
- (selector: string | Node | Node[] | JQuery): Api<T>;
105
+ DataTable<T = any>(opts?: Config): Api<T>;
89
106
 
90
107
  /**
91
- * Get the data for the whole table.
92
- *
93
- * @returns DataTables Api instance with the data for each row in the result set
108
+ * Create a new DataTable, returning a jQuery object, extended
109
+ * with an `api()` method which can be used to access the
110
+ * DataTables API.
111
+ * @param opts Configuration settings
94
112
  */
95
- data(): Api<T>;
113
+ dataTable(opts?: Config): JQueryDataTables;
114
+ }
115
+ }
96
116
 
97
- /**
98
- * Order Methods / object
99
- */
100
- order: OrderMethods;
117
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
118
+ * Options
119
+ */
101
120
 
102
- //#region "Cell/Cells"
121
+ export interface Config {
122
+ /**
123
+ * Load data for the table's content from an Ajax source.
124
+ */
125
+ ajax?: string | AjaxSettings | FunctionAjax;
103
126
 
104
- /**
105
- * Select the cell found by a cell selector
106
- *
107
- * @param cellSelector Cell selector.
108
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
109
- * @returns DataTables API instance with selected cell
110
- */
111
- cell(cellSelector: CellSelector, modifier?: ObjectSelectorModifier): CellMethods<T>;
127
+ /**
128
+ * Feature control DataTables' smart column width handling.
129
+ */
130
+ autoWidth?: boolean;
112
131
 
113
- /**
114
- * Select the cell found by a cell selector
115
- *
116
- * @param rowSelector Row selector.
117
- * @param columnSelector Column selector.
118
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
119
- * @returns DataTables API instance with selected cell
120
- */
121
- cell(rowSelector: CellSelector, columnSelector: any, modifier?: ObjectSelectorModifier): CellMethods<T>;
132
+ /**
133
+ * Data to use as the display data for the table.
134
+ */
135
+ columns?: ConfigColumns[];
122
136
 
123
- /**
124
- * Select all cells
125
- *
126
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
127
- * @returns DataTables API instance with selected cells
128
- */
129
- cells(modifier?: ObjectSelectorModifier): CellsMethods<T>;
137
+ /**
138
+ * Assign a column definition to one or more columns.
139
+ */
140
+ columnDefs?: ConfigColumnDefs[];
130
141
 
131
- /**
132
- * Select cells found by a cell selector
133
- *
134
- * @param cellSelector Cell selector.
135
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
136
- * @returns DataTables API instance with selected cells
137
- */
138
- cells(cellSelector: CellSelector, modifier?: ObjectSelectorModifier): CellsMethods<T>;
142
+ /**
143
+ * Data to use as the display data for the table.
144
+ */
145
+ data?: any[];
139
146
 
140
- /**
141
- * Select cells found by both row and column selectors
142
- *
143
- * @param rowSelector Row selector.
144
- * @param columnSelector Column selector.
145
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
146
- * @returns DataTables API instance with selected cells
147
- */
148
- cells(rowSelector: RowSelector<T>, columnSelector: CellSelector, modifier?: ObjectSelectorModifier): CellsMethods<T>;
149
- //#endregion "Cell/Cells"
147
+ /**
148
+ * Delay the loading of server-side data until second draw
149
+ */
150
+ deferLoading?: number | number[];
151
+
152
+ /**
153
+ * Feature control deferred rendering for additional speed of initialisation.
154
+ */
155
+ deferRender?: boolean;
150
156
 
151
- //#region "Column/Columns"
157
+ /**
158
+ * Destroy any existing table matching the selector and replace with the new options.
159
+ */
160
+ destroy?: boolean;
152
161
 
153
- /**
154
- * Column Methods / object
155
- */
156
- column: ColumnMethodsModel;
162
+ /**
163
+ * Initial paging start point.
164
+ */
165
+ displayStart?: number;
157
166
 
158
- /**
159
- * Columns Methods / object
160
- */
161
- columns: ColumnsMethodsModel<T>;
167
+ /**
168
+ * Define the table control elements to appear on the page and in what order.
169
+ */
170
+ dom?: string;
162
171
 
163
- //#endregion "Column/Columns"
172
+ /**
173
+ * Feature control table information display field.
174
+ */
175
+ info?: boolean;
164
176
 
165
- //#region "Row/Rows"
177
+ /**
178
+ * Language configuration object
179
+ */
180
+ language?: ConfigLanguage;
166
181
 
167
- /**
168
- * Row Methods / object
169
- */
170
- row: RowMethodsModel<T>;
182
+ /**
183
+ * Feature control the end user's ability to change the paging display length of the table.
184
+ */
185
+ lengthChange?: boolean;
171
186
 
172
- /**
173
- * Rows Methods / object
174
- */
175
- rows: RowsMethodsModel<T>;
187
+ /**
188
+ * Change the options in the page length select list.
189
+ */
190
+ lengthMenu?: Array<(number | string)> | Array<Array<(number | string)>>;
176
191
 
177
- //#endregion "Row/Rows"
192
+ /**
193
+ * Control which cell the order event handler will be applied to in a column.
194
+ */
195
+ orderCellsTop?: boolean;
178
196
 
179
- /**
180
- * Plug-in to sum the values in a data set.
181
- *
182
- * @returns number representing the sum of the data set.
183
- */
184
- sum(): number;
197
+ /**
198
+ * Highlight the columns being ordered in the table's body.
199
+ */
200
+ orderClasses?: boolean;
185
201
 
186
- //#region "Table/Tables"
202
+ /**
203
+ * Initial order (sort) to apply to the table.
204
+ */
205
+ order?: Array<(number | string)> | Array<Array<(number | string)>>;
187
206
 
188
- /**
189
- * Select a table based on a selector from the API's context
190
- *
191
- * @param tableSelector Table selector.
192
- * @returns DataTables API instance with selected table in its context.
193
- */
194
- table(tableSelector: any): TableMethods<T> | Api<Array<any>>;
207
+ /**
208
+ * Ordering to always be applied to the table.
209
+ */
210
+ orderFixed?: Array<(number | string)> | Array<Array<(number | string)>> | object;
195
211
 
196
- /**
197
- * Select tables based on the given selector
198
- *
199
- * @param tableSelector Table selector.
200
- * @returns DataTables API instance with all tables in the current context.
201
- */
202
- tables(tableSelector?: any): TablesMethods<T> | Api<Array<any>> ;
212
+ /**
213
+ * Feature control ordering (sorting) abilities in DataTables.
214
+ */
215
+ ordering?: boolean;
203
216
 
204
- //#endregion "Table/Tables"
205
- }
217
+ /**
218
+ * Multiple column ordering ability control.
219
+ */
220
+ orderMulti?: boolean;
206
221
 
207
- interface DataTables<T> extends CoreMethods<T> {
208
- [index: number]: Api<T>;
209
- }
222
+ /**
223
+ * Change the initial page length (number of rows per page).
224
+ */
225
+ pageLength?: number;
210
226
 
211
- interface ObjectSelectorModifier {
212
- /**
213
- * The order modifier provides the ability to control which order the rows are processed in.
214
- * Values: 'current', 'applied', 'index', 'original'
215
- */
216
- order?: string;
227
+ /**
228
+ * Enable or disable table pagination.
229
+ */
230
+ paging?: boolean;
217
231
 
218
- /**
219
- * 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.
220
- * Values: 'none', 'applied', 'removed'
221
- */
222
- search?: string;
232
+ /**
233
+ * Pagination button display options. Basic Types: numbers (1.10.8) simple, simple_numbers, full, full_numbers
234
+ */
235
+ pagingType?: string;
223
236
 
224
- /**
225
- * The searchPlaceholder modifier provides the ability to provide informational text for an input control when it has no value.
226
- */
227
- searchPlaceholder?: string;
237
+ /**
238
+ * Feature control the processing indicator.
239
+ */
240
+ processing?: boolean;
228
241
 
229
- /**
230
- * 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.
231
- * Values: 'all', 'current'
232
- */
233
- page?: string;
234
- }
242
+ /**
243
+ * Display component renderer types.
244
+ */
245
+ renderer?: string | ConfigRenderer;
235
246
 
236
- //#region "Namespaces"
247
+ /**
248
+ * Retrieve an existing DataTables instance.
249
+ */
250
+ retrieve?: boolean;
237
251
 
238
- //#region "core-methods"
252
+ /**
253
+ * Data property name that DataTables will use to set <tr> element DOM IDs. Since: 1.10.8
254
+ */
255
+ rowId?: string;
239
256
 
240
- interface CoreMethods<T> extends UtilityMethods {
241
- /**
242
- * Get jquery object
243
- *
244
- * @param selector jQuery selector to perform on the nodes inside the table's tbody tag.
245
- * @param modifier Option used to specify how the content's of the selected columns should be ordered, and if paging or filtering in the table should be taken into account.
246
- * @returns JQuery object with the matched elements in it's results set
247
- */
248
- $(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery;
257
+ /**
258
+ * Allow the table to reduce in height when a limited number of rows are shown.
259
+ */
260
+ scrollCollapse?: boolean;
249
261
 
250
- /**
251
- * Ajax Methods
252
- */
253
- ajax: AjaxMethodModel;
262
+ /**
263
+ * Horizontal scrolling.
264
+ */
265
+ scrollX?: boolean;
254
266
 
255
- /**
256
- * Clear the table of all data.
257
- *
258
- * @returns DataTables Api instance.
259
- */
260
- clear(): Api<T>;
267
+ /**
268
+ * Vertical scrolling. Since: 1.10 Exp: "200px"
269
+ */
270
+ scrollY?: string;
261
271
 
262
- /**
263
- * Destroy the DataTables in the current context.
264
- *
265
- * @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).
266
- * @returns DataTables Api instance
267
- */
268
- destroy(remove?: boolean): Api<T>;
272
+ /**
273
+ * Set an initial filter in DataTables and / or filtering options.
274
+ */
275
+ search?: ConfigSearch | boolean;
269
276
 
270
- /**
271
- * Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required.
272
- *
273
- * @param paging This parameter is used to determine what kind of draw DataTables will perform.
274
- * @returns DataTables Api instance
275
- */
276
- draw(paging?: boolean | string): Api<T>;
277
-
278
- /**
279
- * Look up a language token that was defined in the DataTables' language initialisation object.
280
- *
281
- * @param token The language token to lookup from the language object.
282
- * @param def The default value to use if the DataTables initialisation has not specified a value. This can be a string for simple cases, or an object for plurals.
283
- * @param numeric If handling numeric output, the number to be presented should be given in this parameter.
284
- *
285
- * @returns Resulting internationalised string.
286
- */
287
- i18n(token: string, def: object | string, numeric?: number): string;
277
+ /**
278
+ * Define an initial search for individual columns.
279
+ */
280
+ searchCols?: ConfigSearch[];
288
281
 
289
- /**
290
- * Get the initialisation options used for the table. Since: DataTables 1.10.6
291
- *
292
- * @returns Configuration object
293
- */
294
- init(): Settings;
282
+ /**
283
+ * Set a throttle frequency for searching.
284
+ */
285
+ searchDelay?: number;
295
286
 
296
- /**
297
- * Remove event listeners that have previously been added with on().
298
- *
299
- * @param event Event name to remove.
300
- * @param callback Specific callback function to remove if you want to unbind a single event listener.
301
- * @returns DataTables Api instance
302
- */
303
- off(event: string, callback?: ((e: Event, ...args: any[]) => void)): Api<T>;
287
+ /**
288
+ * Feature control search (filtering) abilities
289
+ */
290
+ searching?: boolean;
304
291
 
305
- /**
306
- * Table events listener.
307
- *
308
- * @param event Event to listen for.
309
- * @param callback Specific callback function to remove if you want to unbind a single event listener.
310
- * @returns DataTables Api instance
311
- */
312
- on(event: string, callback: ((e: Event, ...args: any[]) => void)): Api<T>;
292
+ /**
293
+ * Feature control DataTables' server-side processing mode.
294
+ */
295
+ serverSide?: boolean;
313
296
 
314
- /**
315
- * Listen for a table event once and then remove the listener.
316
- *
317
- * @param event Event to listen for.
318
- * @param callback Specific callback function to remove if you want to unbind a single event listener.
319
- * Listen for events from tables and fire a callback when they occur
320
- * @returns DataTables Api instance
321
- */
322
- one(event: string, callback: ((e: Event, ...args: any[]) => void)): Api<T>;
297
+ /**
298
+ * Saved state validity duration.
299
+ */
300
+ stateDuration?: number;
323
301
 
324
- /**
325
- * Page Methods / object
326
- */
327
- page: PageMethods;
302
+ /**
303
+ * State saving - restore table state on page reload.
304
+ */
305
+ stateSave?: boolean;
328
306
 
329
- /**
330
- * Get current search
331
- *
332
- * @returns The currently applied global search. This may be an empty string if no search is applied.
333
- */
334
- search(): string;
307
+ /**
308
+ * Set the zebra stripe class names for the rows in the table.
309
+ */
310
+ stripeClasses?: string[];
335
311
 
336
- /**
337
- * Set the global search to use on the table. Note this doesn't actually perform the search.
338
- *
339
- * @param input Search string to apply to the table.
340
- * @param regex Treat as a regular expression (true) or not (default, false).
341
- * @param smart Perform smart search.
342
- * @param caseInsen Do case-insensitive matching (default, true) or not (false).
343
- * @returns DataTables API instance
344
- */
345
- search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
312
+ /**
313
+ * Tab index control for keyboard navigation.
314
+ */
315
+ tabIndex?: number;
346
316
 
347
- /**
348
- * Obtain the table's settings object
349
- *
350
- * @returns DataTables API instance with the settings objects for the tables in the context in the result set
351
- */
352
- settings(): Api<Settings>;
317
+ /**
318
+ * Callback for whenever a TR element is created for the table's body.
319
+ */
320
+ createdRow?: FunctionCreateRow;
353
321
 
354
- /**
355
- * Page Methods / object
356
- */
357
- state: StateMethods;
358
- }
322
+ /**
323
+ * Function that is called every time DataTables performs a draw.
324
+ */
325
+ drawCallback?: FunctionDrawCallback;
359
326
 
360
- //#region "ajax-methods"
327
+ /**
328
+ * Footer display callback function.
329
+ */
330
+ footerCallback?: FunctionFooterCallback;
361
331
 
362
- interface AjaxMethods extends Api<any> {
363
- /**
364
- * Reload the table data from the Ajax data source.
365
- *
366
- * @param callback Function which is executed when the data as been reloaded and the table fully redrawn.
367
- * @param resetPaging Reset (default action or true) or hold the current paging position (false).
368
- * @returns DataTables Api instance
369
- */
370
- load(callback?: ((json: any) => void), resetPaging?: boolean): Api<any>;
371
- }
332
+ /**
333
+ * Number formatting callback function.
334
+ */
335
+ formatNumber?: FunctionFormatNumber;
372
336
 
373
- interface AjaxMethodModel {
374
- /**
375
- * Get the latest JSON data obtained from the last Ajax request DataTables made
376
- *
377
- * @returns JSON object that was last loaded/
378
- */
379
- json(): object;
337
+ /**
338
+ * Header display callback function.
339
+ */
340
+ headerCallback?: FunctionHeaderCallback;
380
341
 
381
- /**
382
- * Get the data submitted by DataTables to the server in the last Ajax request
383
- *
384
- * @returns object containing the data submitted by DataTables
385
- */
386
- params(): object;
342
+ /**
343
+ * Table summary information display callback.
344
+ */
345
+ infoCallback?: FunctionInfoCallback;
387
346
 
388
- /**
389
- * Reload the table data from the Ajax data source.
390
- *
391
- * @param callback Function which is executed when the data as been reloaded and the table fully redrawn.
392
- * @param resetPaging Reset (default action or true) or hold the current paging position (false).
393
- * @returns DataTables Api
394
- */
395
- reload(callback?: ((json: any) => void), resetPaging?: boolean): Api<any>;
347
+ /**
348
+ * Initialisation complete callback.
349
+ */
350
+ initComplete?: FunctionInitComplete;
396
351
 
397
- /**
398
- * Reload the table data from the Ajax data source
399
- *
400
- * @returns URL set as the Ajax data source for the table.
401
- */
402
- url(): string;
352
+ /**
353
+ * Pre-draw callback.
354
+ */
355
+ preDrawCallback?: FunctionPreDrawCallback;
403
356
 
404
- /**
405
- * Reload the table data from the Ajax data source
406
- *
407
- * @param url URL to set to be the Ajax data source for the table.
408
- * @returns DataTables Api instance for chaining or further ajax.url() methods
409
- */
410
- url(url: string): AjaxMethods | Api<any>;
411
- }
357
+ /**
358
+ * Row draw callback..
359
+ */
360
+ rowCallback?: FunctionRowCallback;
412
361
 
413
- //#endregion "ajax-methods"
362
+ /**
363
+ * Callback that defines where and how a saved state should be loaded.
364
+ */
365
+ stateLoadCallback?: FunctionStateLoadCallback;
414
366
 
415
- //#region "order-methods"
367
+ /**
368
+ * State loaded callback.
369
+ */
370
+ stateLoaded?: FunctionStateLoaded;
416
371
 
417
- interface OrderMethods extends APINeutralPlugIn {
418
- /**
419
- * Get the ordering applied to the table.
420
- *
421
- * @returns Array of arrays containing information about the currently applied sort. This 2D array is the same format as the array used for setting the order to apply to the table
422
- */
423
- (): Array<Array<(string | number)>>;
372
+ /**
373
+ * State loaded - data manipulation callback.
374
+ */
375
+ stateLoadParams?: FunctionStateLoadParams;
424
376
 
425
- /**
426
- * Set the ordering applied to the table.
427
- *
428
- * @param order Order Model
429
- * @returns DataTables Api instance
430
- */
431
- (order?: Array<(string | number)> | Array<Array<(string | number)>>): Api<any>;
432
- (order: Array<(string | number)>, ...args: any[]): Api<any>;
377
+ /**
378
+ * Callback that defines how the table state is stored and where.
379
+ */
380
+ stateSaveCallback?: FunctionStateSaveCallback;
433
381
 
434
- /**
435
- * Get the fixed ordering that is applied to the table. If there is more than one table in the API's context,
436
- * the ordering of the first table will be returned only (use table() if you require the ordering of a different table in the API's context).
437
- * @returns object describing the ordering that is applied to the table
438
- */
439
- fixed(): ObjectOrderFixed;
382
+ /**
383
+ * State save - data manipulation callback.
384
+ */
385
+ stateSaveParams?: FunctionStateSaveParams;
386
+ }
440
387
 
441
- /**
442
- * Set the table's fixed ordering. Note this doesn't actually perform the order, but rather queues it up - use draw() to perform the ordering.
443
- *
444
- * @param order Used to indicate whether the ordering should be performed before or after the users own ordering.
445
- * @returns DataTables Api instance
446
- */
447
- fixed(order: ObjectOrderFixed): Api<any>;
448
388
 
449
- /**
450
- * Add an ordering listener to an element, for a given column.
451
- *
452
- * @param node Selector
453
- * @param column Column index
454
- * @param callback Callback function
455
- * @returns DataTables API instance with the current order in the result set
456
- */
457
- listener(node: string | Node | JQuery, column: number, callback: (() => void)): Api<any>;
458
- }
459
- //#endregion "order-methods"
389
+ export interface ConfigLanguage {
390
+ emptyTable?: string;
391
+ info?: string;
392
+ infoEmpty?: string;
393
+ infoFiltered?: string;
394
+ infoPostFix?: string;
395
+ decimal?: string;
396
+ thousands?: string;
397
+ lengthMenu?: string;
398
+ loadingRecords?: string;
399
+ processing?: string;
400
+ search?: string;
401
+ searchPlaceholder?: string;
402
+ zeroRecords?: string;
403
+ paginate?: {
404
+ first?: string;
405
+ last?: string;
406
+ next?: string;
407
+ previous?: string;
408
+ };
409
+ aria?: {
410
+ sortAscending?: string;
411
+ sortDescending?: string;
412
+ paginate?: {
413
+ first?: string;
414
+ last?: string;
415
+ next?: string;
416
+ previous?: string;
417
+ };
418
+ };
419
+ url?: string;
420
+ }
460
421
 
461
- //#region "page-methods"
462
422
 
463
- interface PageMethods extends APIJumpToDataPlugIn {
464
- /**
465
- * Get the current page of the table.
466
- *
467
- * @returns Currently displayed page number
468
- */
469
- (): number;
423
+ export interface ConfigColumns {
424
+ /**
425
+ * Set the column's aria-label title. Since: 1.10.25
426
+ */
427
+ ariaTitle?: string;
470
428
 
471
- /**
472
- * Set the current page of the table.
473
- *
474
- * @param page Index or 'first', 'next', 'previous', 'last'
475
- * @returns DataTables API instance
476
- */
477
- (page: number | string): Api<any>;
429
+ /**
430
+ * Cell type to be created for a column. th/td
431
+ */
432
+ cellType?: string;
478
433
 
479
- /**
480
- * Get paging information about the table
481
- *
482
- * @returns Object with information about the table's paging state.
483
- */
484
- info(): PageMethodeModelInfoReturn;
434
+ /**
435
+ * Class to assign to each cell in the column.
436
+ */
437
+ className?: string;
485
438
 
486
- /**
487
- * Get the table's page length.
488
- *
489
- * @returns Current page length.
490
- */
491
- len(): number;
439
+ /**
440
+ * Add padding to the text content used when calculating the optimal with for a table.
441
+ */
442
+ contentPadding?: string;
492
443
 
493
- /**
494
- * Set the table's page length.
495
- *
496
- * @param length Page length to set. use -1 to show all records.
497
- * @returns DataTables API instance.
498
- */
499
- len(length: number): Api<any>;
500
- }
444
+ /**
445
+ * Cell created callback to allow DOM manipulation.
446
+ */
447
+ createdCell?: FunctionColumnCreatedCell;
501
448
 
502
- interface PageMethodeModelInfoReturn {
503
- page: number;
504
- pages: number;
505
- start: number;
506
- end: number;
507
- length: number;
508
- recordsTotal: number;
509
- recordsDisplay: number;
510
- serverSide: boolean;
511
- }
449
+ /**
450
+ * Class to assign to each cell in the column.
451
+ */
452
+ data?: number | string | ObjectColumnData | FunctionColumnData | null;
512
453
 
513
- //#endregion "page-methods"
454
+ /**
455
+ * Set default, static, content for a column.
456
+ */
457
+ defaultContent?: string;
514
458
 
515
- //#region "state-methods"
459
+ /**
460
+ * Set a descriptive name for a column.
461
+ */
462
+ name?: string;
516
463
 
517
- interface StateMethods {
518
- /**
519
- * Get the last saved state of the table
520
- *
521
- * @returns State saved object
522
- */
523
- (): StateReturnModel;
464
+ /**
465
+ * Enable or disable ordering on this column.
466
+ */
467
+ orderable?: boolean;
524
468
 
525
- /**
526
- * Clear the saved state of the table.
527
- *
528
- * @returns The API instance that was used, available for chaining.
529
- */
530
- clear(): Api<any>;
469
+ /**
470
+ * Define multiple column ordering as the default order for a column.
471
+ */
472
+ orderData?: number | number[];
531
473
 
532
- /**
533
- * Get the table state that was loaded during initialisation.
534
- *
535
- * @returns State saved object. See state() for the object format.
536
- */
537
- loaded(): StateReturnModel;
474
+ /**
475
+ * Live DOM sorting type assignment.
476
+ */
477
+ orderDataType?: string;
538
478
 
539
- /**
540
- * Trigger a state save.
541
- *
542
- * @returns The API instance that was used, available for chaining.
543
- */
544
- save(): Api<any>;
545
- }
479
+ /**
480
+ * Ordering to always be applied to the table. Since 1.10
481
+ *
482
+ * Array type is prefix ordering only and is a two-element array:
483
+ * 0: Column index to order upon.
484
+ * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order).
485
+ */
486
+ orderFixed?: any[] | OrderFixed;
546
487
 
547
- interface StateReturnModel {
548
- time: number;
549
- start: number;
550
- length: number;
551
- order: Array<Array<(string | number)>>;
552
- search: SearchSettings;
553
- columns: StateReturnModelColumns[];
554
- }
488
+ /**
489
+ * Order direction application sequence.
490
+ */
491
+ orderSequence?: string[];
555
492
 
556
- interface StateReturnModelColumns {
557
- search: SearchSettings;
558
- visible: boolean;
559
- }
493
+ /**
494
+ * Render (process) the data for use in the table.
495
+ */
496
+ render?: number | string | ObjectColumnData | FunctionColumnRender | ObjectColumnRender;
560
497
 
561
- //#endregion "state-methods"
498
+ /**
499
+ * Enable or disable filtering on the data in this column.
500
+ */
501
+ searchable?: boolean;
562
502
 
563
- //#endregion "core-methods"
564
- type TIterator = 'table' | 'cell' | 'column-rows' | 'column' | 'columns' | 'row' | 'rows';
503
+ /**
504
+ * Set the column title.
505
+ */
506
+ title?: string;
565
507
 
566
- interface IteratorCallbackFunction {
567
- /**
568
- * "table" - loop over the context's (i.e. the tables) for the instance
569
- *
570
- * @param settings Table settings object
571
- * @param counter Loop counter
572
- */
573
- (settings: Settings, counter: number): any
508
+ /**
509
+ * Set the column type - used for filtering and sorting string processing.
510
+ */
511
+ type?: string;
574
512
 
575
- /**
576
- * "columns" - loop over each item in the result set
577
- *
578
- * @param settings Table settings object
579
- * @param resultItem Result set item
580
- * @param counter Loop counter
581
- */
582
- (settings: Settings, resultItem: any, counter: number): any
513
+ /**
514
+ * Enable or disable the display of this column.
515
+ */
516
+ visible?: boolean;
583
517
 
584
- /**
585
- * "column" - loop over each table and column in the result set
586
- *
587
- * @param settings Table settings object
588
- * @param columnIndex Column index
589
- * @param tableCounter Table counter (outer)
590
- * @param columnCounter Column counter (inner)
591
- */
592
- (settings: Settings, columnIndex: number, tableCounter: number, columnCounter: number): any
518
+ /**
519
+ * Column width assignment.
520
+ */
521
+ width?: string;
522
+ }
593
523
 
594
- /**
595
- * "column-rows" - loop over each table, column and row in the result set applying selector-modifier.
596
- *
597
- * @param settings Table settings object
598
- * @param columnIndex Column index
599
- * @param tableCounter Table counter (outer)
600
- * @param columnCounter Column counter (inner)
601
- * @param rowIndexes Row indexes
602
- */
603
- (settings: Settings, columnIndex: number, tableCounter: number, columnCounter: number, rowIndexes: number[]): any
524
+ export interface ConfigColumnDefs extends ConfigColumns {
525
+ /**
526
+ * Target column(s). Either this or `target` must be specified.
527
+ */
528
+ targets?: string | number | Array<(number | string)>;
604
529
 
605
- /**
606
- * "rows" - loop over each item in the result set
607
- *
608
- * @param settings Table settings object
609
- * @param resultItem Result set item
610
- * @param counter Loop counter
611
- */
612
- (settings: Settings, resultItem: any, counter: number): any
530
+ /**
531
+ * Single column target. Either this or `targets` must be specified. Since: 1.12
532
+ */
533
+ target: string | number;
534
+ }
613
535
 
614
- /**
615
- * "row" - loop over each table and row in the result set
616
- *
617
- * @param settings Table settings object
618
- * @param rowIndex Row index
619
- * @param tableCounter Table counter (outer)
620
- * @param rowCounter Row counter (inner)
621
- */
622
- (settings: Settings, rowIndex: number, tableCounter: number, rowCounter: number): any
536
+ export interface ConfigRenderer {
537
+ header?: string;
538
+ pageButton?: string;
539
+ }
623
540
 
624
- /**
625
- * "cell" - loop over each table and cell in the result set
626
- *
627
- * @param settings Table settings object
628
- * @param rowIndex Row index
629
- * @param columnIndex Column index
630
- * @param tableCounter Table counter (outer)
631
- * @param cellCounter Cell counter (inner)
632
- */
633
- (settings: Settings, rowIndex: number, columnIndex: number, tableCounter: number, cellCounter: number): any
634
-
635
- }
541
+ export interface ConfigSearch {
542
+ /**
543
+ * Control case-sensitive filtering option.
544
+ */
545
+ caseInsensitive?: boolean;
636
546
 
637
- //#region "util-methods"
547
+ /**
548
+ * Enable / disable escaping of regular expression characters in the search term.
549
+ */
550
+ regex?: boolean;
638
551
 
639
- interface UtilityMethods {
640
- /**
641
- * 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).
642
- * @returns true if there there is one or more items in the result set, false otherwise.
643
- */
644
- any(): boolean;
552
+ /**
553
+ * Enable / disable DataTables' smart filtering.
554
+ */
555
+ smart?: boolean;
645
556
 
646
- /**
647
- * Concatenate two or more API instances together
648
- *
649
- * @param a API instance to concatenate to the initial instance.
650
- * @param b Additional API instance(s) to concatenate to the initial instance.
651
- * @returns New API instance with the values from all passed in instances concatenated into its result set.
652
- */
653
- concat(a: object, ...b: object[]): Api<any>;
557
+ /**
558
+ * Set an initial filtering condition on the table.
559
+ */
560
+ search?: string;
654
561
 
655
- /**
656
- * 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
657
- *
658
- * @returns The number of items in the API instance's result set
659
- */
660
- count(): number;
562
+ /**
563
+ * Set a placeholder attribute for input type="text" tag elements. Since: 1.10.1
564
+ */
565
+ searchPlaceholder?: string;
566
+ }
661
567
 
662
- /**
663
- * Iterate over the contents of the API result set.
664
- *
665
- * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters
666
- * @returns Original API instance that was used. For chaining.
667
- */
668
- each(fn: ((value: any, index: number, dt: Api<any>) => void)): Api<any>;
669
568
 
670
- /**
671
- * Reduce an Api instance to a single context and result set.
672
- *
673
- * @param idx Index to select
674
- * @returns New DataTables API instance with the context and result set containing the table and data for the index specified, or null if no matching index was available.
675
- */
676
- eq(idx: number): Api<any>;
569
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
570
+ * API
571
+ */
572
+ export interface Api<T> {
573
+ /**
574
+ * API should be array-like
575
+ */
576
+ [key: number]: any;
677
577
 
678
- /**
679
- * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass.
680
- *
681
- * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters.
682
- * @returns New API instance with the values from the result set which passed the test in the callback.
683
- */
684
- filter(fn: ((value: any, index: number, dt: Api<any>) => boolean)): Api<Array<any>>;
578
+ /**
579
+ * Returns DataTables API instance
580
+ *
581
+ * @param table Selector string for table
582
+ */
583
+ (selector: string | Node | Node[] | JQuery): Api<T>;
685
584
 
686
- /**
687
- * Flatten a 2D array structured API instance to a 1D array structure.
688
- *
689
- * @returns New API instance with the 2D array values reduced to a 1D array.
690
- */
691
- flatten(): Api<Array<any>>;
585
+ /**
586
+ * Get jquery object
587
+ *
588
+ * @param selector jQuery selector to perform on the nodes inside the table's tbody tag.
589
+ * @param modifier Option used to specify how the content's of the selected columns should be ordered, and if paging or filtering in the table should be taken into account.
590
+ * @returns JQuery object with the matched elements in it's results set
591
+ */
592
+ $(selector: string | Node | Node[] | JQuery, modifier?: ApiSelectorModifier): JQuery;
692
593
 
693
- /**
694
- * Find the first instance of a value in the API instance's result set.
695
- *
696
- * @param value Value to find in the instance's result set.
697
- * @returns The index of the item in the result set, or -1 if not found.
698
- */
699
- indexOf(value: any): number;
594
+ /**
595
+ * Ajax Methods
596
+ */
597
+ ajax: ApiAjax;
700
598
 
701
- /**
702
- * Iterate over a result set of table, row, column or cell indexes
703
- *
704
- * @param type Iterator type
705
- * @param callback Callback function that is executed on each iteration. For the parameters passed to the function, please refer to the documentation above. As of this is executed in the scope of an API instance which has its context set to only the table in question.
706
- * @param returns Indicate if the callback function will return values or not. If set to true a new API instance will be returns with the return values from the callback function in its result set. If not set, or false the original instance will be returned for chaining, if no values are returned by the callback method.
707
- * @returns Original API instance if the callback returns no result (i.e. undefined) or a new API instance with the result set being the results from the callback, in order of execution.
708
- */
709
- iterator(type: TIterator, callback: IteratorCallbackFunction, returns?: boolean): Api<any>;
710
- /**
711
- * Iterate over a result set of table, row, column or cell indexes
712
- *
713
- * @param flatten If true the result set of the returned API instance will be a 1D array (i.e. flattened into a single array). If false (or not specified) each result will be concatenated to the instance's result set. Note that this is only relevant if you are returning arrays from the callback.
714
- * @param type Iterator type
715
- * @param callback Callback function that is executed on each iteration. For the parameters passed to the function, please refer to the documentation above. As of this is executed in the scope of an API instance which has its context set to only the table in question.
716
- * @param returns Indicate if the callback function will return values or not. If set to true a new API instance will be returns with the return values from the callback function in its result set. If not set, or false the original instance will be returned for chaining, if no values are returned by the callback method.
717
- * @returns Original API instance if the callback returns no result (i.e. undefined) or a new API instance with the result set being the results from the callback, in order of execution.
718
- */
719
- iterator(flatten: boolean, type: TIterator, callback: IteratorCallbackFunction, returns: boolean): Api<any>;
720
- iterator(flatten: any, type: any, callback: any, returns?: any): Api<any>;
599
+ /**
600
+ * 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).
601
+ * @returns true if there there is one or more items in the result set, false otherwise.
602
+ */
603
+ any(): boolean;
721
604
 
722
- /**
723
- * Join the elements in the result set into a string.
724
- *
725
- * @param separator The string that will be used to separate each element of the result set.
726
- * @returns Contents of the instance's result set joined together as a single string.
727
- */
728
- join(separator: string): string;
605
+ /**
606
+ * Cell (single) selector and methods
607
+ */
608
+ cell: ApiCell<T>;
729
609
 
730
- /**
731
- * Find the last instance of a value in the API instance's result set.
732
- *
733
- * @param value Value to find in the instance's result set.
734
- * @returns The index of the item in the result set, or -1 if not found.
735
- */
736
- lastIndexOf(value: any): number;
610
+ /**
611
+ * Cells (multiple) selector and methods
612
+ */
613
+ cells: ApiCells<T>;
737
614
 
738
- /**
739
- * Number of elements in an API instance's result set.
740
- */
741
- length: number;
615
+ /**
616
+ * Clear the table of all data.
617
+ *
618
+ * @returns DataTables Api instance.
619
+ */
620
+ clear(): Api<T>;
742
621
 
743
- /**
744
- * Iterate over the result set of an API instance, creating a new API instance from the values returned by the callback.
745
- *
746
- * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters.
747
- * @returns New API instance with the values in the result set as those returned by the callback.
748
- */
749
- map(fn: ((value: any, index: number, dt: Api<any>) => any)): Api<any>;
622
+ /**
623
+ * Column Methods / object
624
+ */
625
+ column: ApiColumn;
750
626
 
751
- /**
752
- * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements.
753
- *
754
- * @param property object property name to use from the element in the original result set for the new result set.
755
- * @returns New API instance with the values in the result retrieved from the source object properties defined by the property being plucked.
756
- */
757
- pluck(property: number | string): Api<any>;
627
+ /**
628
+ * Columns Methods / object
629
+ */
630
+ columns: ApiColumns<T>;
758
631
 
759
- /**
760
- * Remove the last item from an API instance's result set.
761
- *
762
- * @returns Item removed form the result set (was previously the last item in the result set).
763
- */
764
- pop(): any;
632
+ /**
633
+ * Concatenate two or more API instances together
634
+ *
635
+ * @param a API instance to concatenate to the initial instance.
636
+ * @param b Additional API instance(s) to concatenate to the initial instance.
637
+ * @returns New API instance with the values from all passed in instances concatenated into its result set.
638
+ */
639
+ concat(a: object, ...b: object[]): Api<any>;
765
640
 
766
- /**
767
- * Add one or more items to the end of an API instance's result set.
768
- *
769
- * @param value_1 Item to add to the API instance's result set.
770
- * @returns The length of the modified API instance
771
- */
772
- push(value_1: any, ...value_2: any[]): number;
641
+ /**
642
+ * 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
643
+ *
644
+ * @returns The number of items in the API instance's result set
645
+ */
646
+ count(): number;
773
647
 
774
- /**
775
- * Apply a callback function against and accumulator and each element in the Api's result set (left-to-right).
776
- *
777
- * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters.
778
- * @param initialValue Value to use as the first argument of the first call to the fn callback.
779
- * @returns Result from the final call to the fn callback function.
780
- */
781
- reduce(fn: ((current: number, value: any, index: number, dt: Api<any>) => number), initialValue?: any): any;
648
+ /**
649
+ * Get the data for the whole table.
650
+ *
651
+ * @returns DataTables Api instance with the data for each row in the result set
652
+ */
653
+ data(): Api<T>;
782
654
 
783
- /**
784
- * Apply a callback function against and accumulator and each element in the Api's result set (right-to-left).
785
- *
786
- * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters.
787
- * @param initialValue Value to use as the first argument of the first call to the fn callback.
788
- * @returns Result from the final call to the fn callback function.
789
- */
790
- reduceRight(fn: ((current: number, value: any, index: number, dt: Api<any>) => number), initialValue?: any): any;
655
+ /**
656
+ * Destroy the DataTables in the current context.
657
+ *
658
+ * @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).
659
+ * @returns DataTables Api instance
660
+ */
661
+ destroy(remove?: boolean): Api<T>;
791
662
 
792
- /**
793
- * Reverse the result set of the API instance and return the original array.
794
- *
795
- * @returns The original API instance with the result set in reversed order.
796
- */
797
- reverse(): Api<any>;
663
+ /**
664
+ * Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required.
665
+ *
666
+ * @param paging This parameter is used to determine what kind of draw DataTables will perform.
667
+ * @returns DataTables Api instance
668
+ */
669
+ draw(paging?: boolean | string): Api<T>;
798
670
 
799
- /**
800
- * Remove the first item from an API instance's result set.
801
- *
802
- * @returns Item removed form the result set (was previously the first item in the result set).
803
- */
804
- shift(): any;
671
+ /**
672
+ * Iterate over the contents of the API result set.
673
+ *
674
+ * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters
675
+ * @returns Original API instance that was used. For chaining.
676
+ */
677
+ each(fn: ((value: any, index: number, dt: Api<any>) => void)): Api<any>;
805
678
 
806
- /**
807
- * Create an independent copy of the API instance.
808
- *
809
- * @returns DataTables API instance
810
- */
811
- slice(): Api<any>;
679
+ /**
680
+ * Reduce an Api instance to a single context and result set.
681
+ *
682
+ * @param idx Index to select
683
+ * @returns New DataTables API instance with the context and result set containing the table and data for the index specified, or null if no matching index was available.
684
+ */
685
+ eq(idx: number): Api<any>;
812
686
 
813
- /**
814
- * Sort the elements of the API instance's result set.
815
- *
816
- * @param fn This is a standard Javascript sort comparison function. It accepts two parameters.
817
- * @returns The original API instance with the result set sorted as defined by the sorting conditions used.
818
- */
819
- sort(fn?: ((value1: any, value2: any) => number)): Api<Array<any>>;
687
+ /**
688
+ * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass.
689
+ *
690
+ * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters.
691
+ * @returns New API instance with the values from the result set which passed the test in the callback.
692
+ */
693
+ filter(fn: ((value: any, index: number, dt: Api<any>) => boolean)): Api<Array<any>>;
820
694
 
821
- /**
822
- * Modify the contents of an Api instance's result set, adding or removing items from it as required.
823
- *
824
- * @param index Index at which to start modifying the Api instance's result set.
825
- * @param howMany Number of elements to remove from the result set.
826
- * @param value_1 Item to add to the result set at the index specified by the first parameter.
827
- * @returns An array of the items which were removed. If no elements were removed, an empty array is returned.
828
- */
829
- splice(index: number, howMany: number, value_1?: any, ...value_2: any[]): any[];
695
+ /**
696
+ * Flatten a 2D array structured API instance to a 1D array structure.
697
+ *
698
+ * @returns New API instance with the 2D array values reduced to a 1D array.
699
+ */
700
+ flatten(): Api<Array<any>>;
701
+
702
+ /**
703
+ * Look up a language token that was defined in the DataTables' language initialisation object.
704
+ *
705
+ * @param token The language token to lookup from the language object.
706
+ * @param def The default value to use if the DataTables initialisation has not specified a value. This can be a string for simple cases, or an object for plurals.
707
+ * @param numeric If handling numeric output, the number to be presented should be given in this parameter.
708
+ *
709
+ * @returns Resulting internationalised string.
710
+ */
711
+ i18n(token: string, def: object | string, numeric?: number): string;
830
712
 
831
- /**
832
- * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set.
833
- *
834
- * @returns jQuery object which contains the values from the API instance's result set.
835
- */
836
- to$(): JQuery;
713
+ /**
714
+ * Find the first instance of a value in the API instance's result set.
715
+ *
716
+ * @param value Value to find in the instance's result set.
717
+ * @returns The index of the item in the result set, or -1 if not found.
718
+ */
719
+ indexOf(value: any): number;
837
720
 
838
- /**
839
- * Create a native Javascript array object from an API instance.
840
- *
841
- * @returns Javascript array which contains the values from the API instance's result set.
842
- */
843
- toArray(): any[];
721
+ /**
722
+ * Get the initialisation options used for the table. Since: DataTables 1.10.6
723
+ *
724
+ * @returns Configuration object
725
+ */
726
+ init(): Config;
844
727
 
845
- /**
846
- * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set.
847
- *
848
- * @returns jQuery object which contains the values from the API instance's result set.
849
- */
850
- toJQuery(): JQuery;
728
+ /**
729
+ * Iterate over a result set of table, row, column or cell indexes
730
+ *
731
+ * @param type Iterator type
732
+ * @param callback Callback function that is executed on each iteration. For the parameters passed to the function, please refer to the documentation above. As of this is executed in the scope of an API instance which has its context set to only the table in question.
733
+ * @param returns Indicate if the callback function will return values or not. If set to true a new API instance will be returns with the return values from the callback function in its result set. If not set, or false the original instance will be returned for chaining, if no values are returned by the callback method.
734
+ * @returns Original API instance if the callback returns no result (i.e. undefined) or a new API instance with the result set being the results from the callback, in order of execution.
735
+ */
736
+ iterator(type: 'table', callback: InteratorTable, returns: boolean): Api<any>;
737
+ iterator(type: 'cell', callback: InteratorCell, returns: boolean): Api<any>;
738
+ iterator(type: 'column-rows', callback: InteratorColumnRows, returns: boolean): Api<any>;
739
+ iterator(type: 'column', callback: InteratorColumn, returns: boolean): Api<any>;
740
+ iterator(type: 'columns', callback: InteratorColumns, returns: boolean): Api<any>;
741
+ iterator(type: 'row', callback: InteratorRow, returns: boolean): Api<any>;
742
+ iterator(type: 'rows', callback: InteratorRows, returns: boolean): Api<any>;
851
743
 
852
- /**
853
- * Create a new API instance containing only the unique items from a the elements in an instance's result set.
854
- *
855
- * @returns New Api instance which contains the unique items from the original instance's result set, in its own result set.
856
- */
857
- unique(): Api<any>;
744
+ /**
745
+ * Iterate over a result set of table, row, column or cell indexes
746
+ *
747
+ * @param flatten If true the result set of the returned API instance will be a 1D array (i.e. flattened into a single array). If false (or not specified) each result will be concatenated to the instance's result set. Note that this is only relevant if you are returning arrays from the callback.
748
+ * @param type Iterator type
749
+ * @param callback Callback function that is executed on each iteration. For the parameters passed to the function, please refer to the documentation above. As of this is executed in the scope of an API instance which has its context set to only the table in question.
750
+ * @param returns Indicate if the callback function will return values or not. If set to true a new API instance will be returns with the return values from the callback function in its result set. If not set, or false the original instance will be returned for chaining, if no values are returned by the callback method.
751
+ * @returns Original API instance if the callback returns no result (i.e. undefined) or a new API instance with the result set being the results from the callback, in order of execution.
752
+ */
753
+ iterator(flatten: boolean, type: 'table', callback: InteratorTable, returns: boolean): Api<any>;
754
+ iterator(flatten: boolean, type: 'cell', callback: InteratorCell, returns: boolean): Api<any>;
755
+ iterator(flatten: boolean, type: 'column-rows', callback: InteratorColumnRows, returns: boolean): Api<any>;
756
+ iterator(flatten: boolean, type: 'column', callback: InteratorColumn, returns: boolean): Api<any>;
757
+ iterator(flatten: boolean, type: 'columns', callback: InteratorColumns, returns: boolean): Api<any>;
758
+ iterator(flatten: boolean, type: 'row', callback: InteratorRow, returns: boolean): Api<any>;
759
+ iterator(flatten: boolean, type: 'rows', callback: InteratorRows, returns: boolean): Api<any>;
858
760
 
859
- /**
860
- * Add one or more items to the start of an API instance's result set.
861
- *
862
- * @param value_1 Item to add to the API instance's result set.
863
- * @returns The length of the modified API instance
864
- */
865
- unshift(value_1: any, ...value_2: any[]): number;
866
- }
761
+ /**
762
+ * Join the elements in the result set into a string.
763
+ *
764
+ * @param separator The string that will be used to separate each element of the result set.
765
+ * @returns Contents of the instance's result set joined together as a single string.
766
+ */
767
+ join(separator: string): string;
867
768
 
868
- //#endregion "util-methods"
769
+ /**
770
+ * Find the last instance of a value in the API instance's result set.
771
+ *
772
+ * @param value Value to find in the instance's result set.
773
+ * @returns The index of the item in the result set, or -1 if not found.
774
+ */
775
+ lastIndexOf(value: any): number;
869
776
 
870
- //#region "cell-methods"
777
+ /**
778
+ * Number of elements in an API instance's result set.
779
+ */
780
+ length: number;
871
781
 
872
- interface CommonCellMethods {
782
+ /**
783
+ * Iterate over the result set of an API instance, creating a new API instance from the values returned by the callback.
784
+ *
785
+ * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters.
786
+ * @returns New API instance with the values in the result set as those returned by the callback.
787
+ */
788
+ map(fn: ((value: any, index: number, dt: Api<any>) => any)): Api<any>;
873
789
 
874
- /**
875
- * Get the DataTables cached data for the selected cell(s)
876
- *
877
- * @param type Specify which cache the data should be read from. Can take one of two values: search or order
878
- * @returns DataTables API instance with the cached data for each selected cell in the result set
879
- */
880
- cache(type: string): Api<any>;
790
+ /**
791
+ * Remove event listeners that have previously been added with on().
792
+ *
793
+ * @param event Event name to remove.
794
+ * @param callback Specific callback function to remove if you want to unbind a single event listener.
795
+ * @returns DataTables Api instance
796
+ */
797
+ off(event: string, callback?: ((e: Event, ...args: any[]) => void)): Api<T>;
881
798
 
882
- /**
883
- * Invalidate the data held in DataTables for the selected cell(s)
884
- *
885
- * @param source Data source to read the new data from.
886
- * @returns DataTables API instance with selected cell references in the result set
887
- */
888
- invalidate(source?: string): Api<object>;
799
+ /**
800
+ * Table events listener.
801
+ *
802
+ * @param event Event to listen for.
803
+ * @param callback Specific callback function to remove if you want to unbind a single event listener.
804
+ * @returns DataTables Api instance
805
+ */
806
+ on(event: string, callback: ((e: Event, ...args: any[]) => void)): Api<T>;
889
807
 
890
- /**
891
- * Get data for the selected cell
892
- *
893
- * @param type Data type to get. This can be one of: 'display', 'filter', 'sort', 'type'
894
- * @returns Rendered data for the requested type
895
- */
896
- render(type: string): any;
897
- }
808
+ /**
809
+ * Listen for a table event once and then remove the listener.
810
+ *
811
+ * @param event Event to listen for.
812
+ * @param callback Specific callback function to remove if you want to unbind a single event listener.
813
+ * Listen for events from tables and fire a callback when they occur
814
+ * @returns DataTables Api instance
815
+ */
816
+ one(event: string, callback: ((e: Event, ...args: any[]) => void)): Api<T>;
898
817
 
899
- interface CellMethods<T> extends CoreMethods<T>, CommonCellMethods {
900
- /**
901
- * Get data for the selected cell
902
- *
903
- * @returns the data from the cell
904
- */
905
- data(): any;
818
+ /**
819
+ * Page Methods / object
820
+ */
821
+ page: ApiPage;
906
822
 
907
- /**
908
- * Get data for the selected cell
909
- *
910
- * @param data Value to assign to the data for the cell
911
- * @returns DataTables Api instance
912
- */
913
- data(data: any): Api<T>;
823
+ /**
824
+ * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements.
825
+ *
826
+ * @param property object property name to use from the element in the original result set for the new result set.
827
+ * @returns New API instance with the values in the result retrieved from the source object properties defined by the property being plucked.
828
+ */
829
+ pluck(property: number | string): Api<any>;
914
830
 
915
- /**
916
- * Get index information about the selected cell
917
- *
918
- * @returns Object with index information for the selected cell.
919
- */
920
- index(): CellIndexReturn;
831
+ /**
832
+ * Remove the last item from an API instance's result set.
833
+ *
834
+ * @returns Item removed form the result set (was previously the last item in the result set).
835
+ */
836
+ pop(): any;
921
837
 
922
- /**
923
- * Get the DOM element for the selected cell
924
- *
925
- * @returns The TD / TH cell the selector resolved to
926
- */
927
- node(): Node;
928
- }
838
+ /**
839
+ * Add one or more items to the end of an API instance's result set.
840
+ *
841
+ * @param value_1 Item to add to the API instance's result set.
842
+ * @returns The length of the modified API instance
843
+ */
844
+ push(value_1: any, ...value_2: any[]): number;
929
845
 
930
- interface CellIndexReturn {
931
- row: number;
932
- column: number;
933
- columnVisible: number;
934
- }
846
+ /**
847
+ * Order Methods / object
848
+ */
849
+ order: ApiOrder;
935
850
 
936
- interface CellsMethods<T> extends CoreMethods<T>, CommonCellMethods {
937
- /**
938
- * Get data for the selected cells
939
- *
940
- * @returns DataTables API instance with data for each cell in the selected columns in the result set. This is a 1D array with each entry being the data for the cells from the selected column.
941
- */
942
- data(): Api<Array<any>>;
851
+ /**
852
+ * Apply a callback function against and accumulator and each element in the Api's result set (left-to-right).
853
+ *
854
+ * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters.
855
+ * @param initialValue Value to use as the first argument of the first call to the fn callback.
856
+ * @returns Result from the final call to the fn callback function.
857
+ */
858
+ reduce(fn: ((current: number, value: any, index: number, dt: Api<any>) => number), initialValue?: any): any;
943
859
 
944
- /**
945
- * Iterate over each selected cell, with the function context set to be the cell in question. Since: DataTables 1.10.6
946
- *
947
- * @param fn Function to execute for every cell selected.
948
- */
949
- every(fn: (this: CellMethods<T>, cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api<any>;
860
+ /**
861
+ * Apply a callback function against and accumulator and each element in the Api's result set (right-to-left).
862
+ *
863
+ * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters.
864
+ * @param initialValue Value to use as the first argument of the first call to the fn callback.
865
+ * @returns Result from the final call to the fn callback function.
866
+ */
867
+ reduceRight(fn: ((current: number, value: any, index: number, dt: Api<any>) => number), initialValue?: any): any;
950
868
 
951
- /**
952
- * Get index information about the selected cells
953
- */
954
- indexes(): Api<any>;
869
+ /**
870
+ * Reverse the result set of the API instance and return the original array.
871
+ *
872
+ * @returns The original API instance with the result set in reversed order.
873
+ */
874
+ reverse(): Api<any>;
955
875
 
956
- /**
957
- * Get the DOM elements for the selected cells
958
- */
959
- nodes(): Api<any>;
960
- }
961
- //#endregion "cell-methods"
876
+ /**
877
+ * Row Methods / object
878
+ */
879
+ row: ApiRow<T>;
962
880
 
963
- //#region "column-methods"
881
+ /**
882
+ * Rows Methods / object
883
+ */
884
+ rows: ApiRows<T>;
964
885
 
965
- interface CommonColumnMethod {
966
- /**
967
- * Get the DataTables cached data for the selected column(s)
968
- *
969
- * @param type Specify which cache the data should be read from. Can take one of two values: search or order
970
- * @return DataTables Api instance with an caches data for the selected column(s)
971
- */
972
- cache(type: string): Api<any>;
886
+ /**
887
+ * Get current search
888
+ *
889
+ * @returns The currently applied global search. This may be an empty string if no search is applied.
890
+ */
891
+ search(): string;
973
892
 
974
- /**
975
- * Get the footer th / td cell for the selected column(s).
976
- *
977
- * @returns HTML element for the footer of the column(s)
978
- */
979
- footer(): HTMLElement;
893
+ /**
894
+ * Set the global search to use on the table. Note this doesn't actually perform the search.
895
+ *
896
+ * @param input Search string to apply to the table.
897
+ * @param regex Treat as a regular expression (true) or not (default, false).
898
+ * @param smart Perform smart search.
899
+ * @param caseInsen Do case-insensitive matching (default, true) or not (false).
900
+ * @returns DataTables API instance
901
+ */
902
+ search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
980
903
 
981
- /**
982
- * Get the header th / td cell for a column(s).
983
- *
984
- * @returns HTML element for the header of the column(s)
985
- */
986
- header(): HTMLElement;
904
+ /**
905
+ * Obtain the table's settings object
906
+ *
907
+ * @returns DataTables API instance with the settings objects for the tables in the context in the result set
908
+ */
909
+ settings(): Api<InternalSettings>;
987
910
 
988
- /**
989
- * Order the table, in the direction specified, by the column(s) selected by the column()DT selector.
990
- *
991
- * @param direction Direction of sort to apply to the selected column(s) - desc (descending) or asc (ascending).
992
- * @returns DataTables API instance
993
- */
994
- order(direction: string): Api<any>;
911
+ /**
912
+ * Remove the first item from an API instance's result set.
913
+ *
914
+ * @returns Item removed form the result set (was previously the first item in the result set).
915
+ */
916
+ shift(): any;
995
917
 
996
- /**
997
- * Get the visibility of the selected column(s).
998
- *
999
- * @returns true if the column(s) is visible, false if it is not.
1000
- */
1001
- visible(): boolean;
1002
-
1003
- /**
1004
- * Set the visibility of the selected column(s).
1005
- *
1006
- * @param show Specify if the column(s) should be visible (true) or not (false).
1007
- * @param redrawCalculations Indicate if DataTables should recalculate the column(s) layout (true - default) or not (false).
1008
- * @returns DataTables API instance with selected column(s) in the result set.
1009
- */
1010
- visible(show: boolean, redrawCalculations?: boolean): Api<any>;
1011
- }
1012
-
1013
- interface ColumnMethodsModel {
1014
- /**
1015
- * Select the column found by a column selector
1016
- *
1017
- * @param cellSelector Cell selector.
1018
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1019
- */
1020
- (columnSelector: ColumnSelector, modifier?: ObjectSelectorModifier): ColumnMethods;
1021
-
1022
- /**
1023
- * Convert from the input column index type to that required.
1024
- *
1025
- * @param type The type on conversion that should take place: 'fromVisible', 'toData', 'fromData', 'toVisible'
1026
- * @param index The index to be converted
1027
- * @returns Calculated column index
1028
- */
1029
- index(type: string, index: number): number;
1030
- }
1031
-
1032
- interface ColumnMethods extends CommonColumnMethod {
1033
- /**
1034
- * Get the data for the cells in the selected column.
1035
- *
1036
- * @returns DataTables API instance with data for each cell in the selected columns in the result set. This is a 1D array with each entry being the data for the cells from the selected column.
1037
- */
1038
- data(): Api<Array<any>>;
1039
-
1040
- /**
1041
- * Get the data source property for the selected column.
1042
- *
1043
- * @returns the data source property
1044
- */
1045
- dataSrc(): number | string | (() => string);
1046
-
1047
- /**
1048
- * Get the column index of the selected column.
1049
- *
1050
- * @param type Specify if you want to get the column data index (default) or the visible index (visible).
1051
- * @returns The column index for the selected column.
1052
- */
1053
- index(type?: string): number;
1054
-
1055
- /**
1056
- * Obtain the th / td nodes for the selected column
1057
- *
1058
- * @returns DataTables API instance with each cell's node from the selected columns in the result set. This is a 1D array with each entry being the node for the cells from the selected column.
1059
- */
1060
- nodes(): Api<Array<Node>>;
1061
-
1062
- /**
1063
- * Get the currently applied column search.
1064
- *
1065
- * @returns the currently applied column search.
1066
- */
1067
- search(): string;
1068
-
1069
- /**
1070
- * Set the search term for the matched columns.
1071
- *
1072
- * @param input Search string to apply.
1073
- * @param regex Treat as a regular expression (true) or not (default, false).
1074
- * @param smart Perform smart search.
1075
- * @param caseInsen Do case-insensitive matching (default, true) or not (false).
1076
- * @returns DataTables API instance
1077
- */
1078
- search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
1079
- }
1080
-
1081
- interface ColumnsMethodsModel<T> {
1082
- /**
1083
- * Select all columns
1084
- *
1085
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1086
- * @returns DataTables API instance with selected columns in the result set.
1087
- */
1088
- (modifier?: ObjectSelectorModifier): ColumnsMethods | Api<Array<any>>;
1089
-
1090
- /**
1091
- * Select columns found by a cell selector
1092
- *
1093
- * @param cellSelector Cell selector.
1094
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1095
- * @returns DataTables API instance with selected columns
1096
- */
1097
- (columnSelector: ColumnSelector, modifier?: ObjectSelectorModifier): ColumnsMethods;
1098
-
1099
- /**
1100
- * Recalculate the column widths for layout.
1101
- *
1102
- * @returns DataTables API instance.
1103
- */
1104
- adjust(): Api<T>;
1105
- }
1106
-
1107
- interface ILanguage extends DataTables.LanguageSettings {
1108
-
1109
- }
918
+ /**
919
+ * Create an independent copy of the API instance.
920
+ *
921
+ * @returns DataTables API instance
922
+ */
923
+ slice(): Api<any>;
1110
924
 
1111
- interface ColumnsMethods extends CommonColumnMethod{
1112
- /**
1113
- * Obtain the data for the columns from the selector
1114
- *
1115
- * @returns DataTables API instance with data for each cell in the selected columns in the result set. This is a 2D array with the top level array entries for each column matched by the columns() selector.
1116
- */
1117
- data(): Api<Array<Array<any>>>;
925
+ /**
926
+ * Sort the elements of the API instance's result set.
927
+ *
928
+ * @param fn This is a standard Javascript sort comparison function. It accepts two parameters.
929
+ * @returns The original API instance with the result set sorted as defined by the sorting conditions used.
930
+ */
931
+ sort(fn?: ((value1: any, value2: any) => number)): Api<Array<any>>;
1118
932
 
1119
- /**
1120
- * Get the data source property for the selected columns.
1121
- *
1122
- * @returns API instance with the result set containing the data source parameters for the selected columns as configured by
1123
- */
1124
- dataSrc(): Api<any>;
933
+ /**
934
+ * Modify the contents of an Api instance's result set, adding or removing items from it as required.
935
+ *
936
+ * @param index Index at which to start modifying the Api instance's result set.
937
+ * @param howMany Number of elements to remove from the result set.
938
+ * @param value_1 Item to add to the result set at the index specified by the first parameter.
939
+ * @returns An array of the items which were removed. If no elements were removed, an empty array is returned.
940
+ */
941
+ splice(index: number, howMany: number, value_1?: any, ...value_2: any[]): any[];
1125
942
 
1126
- /**
1127
- * Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6
1128
- *
1129
- * @param fn Function to execute for every column selected.
1130
- * @returns DataTables API instance of the selected columns.
1131
- */
1132
- every(fn: (this: ColumnMethods, colIdx: number, tableLoop: number, colLoop: number) => void): Api<any>;
943
+ /**
944
+ * Page Methods / object
945
+ */
946
+ state: ApiState<T>;
1133
947
 
1134
- /**
1135
- * Get the column indexes of the selected columns.
1136
- *
1137
- * @param type Specify if you want to get the column data index (default) or the visible index (visible).
1138
- * @returns DataTables API instance with selected columns' indexes in the result set.
1139
- */
1140
- indexes(type?: string): Api<Array<number>>;
948
+ /**
949
+ * Select a table based on a selector from the API's context
950
+ *
951
+ * @param tableSelector Table selector.
952
+ * @returns DataTables API instance with selected table in its context.
953
+ */
954
+ table(tableSelector: any): ApiTableMethods<T> | Api<Array<any>>;
1141
955
 
1142
- /**
1143
- * Obtain the th / td nodes for the selected columns
1144
- *
1145
- * @returns DataTables API instance with each cell's node from the selected columns in the result set. This is a 2D array with the top level array entries for each column matched by the columns() selector.
1146
- */
1147
- nodes(): Api<Array<Array<Node>>>;
956
+ /**
957
+ * Select tables based on the given selector
958
+ *
959
+ * @param tableSelector Table selector.
960
+ * @returns DataTables API instance with all tables in the current context.
961
+ */
962
+ tables(tableSelector?: any): ApiTablesMethods<T> | Api<Array<any>>;
1148
963
 
1149
- /**
1150
- * Get the currently applied columns search.
1151
- *
1152
- * @returns the currently applied columns search.
1153
- */
1154
- search(): Api<Array<string>>;
964
+ /**
965
+ * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set.
966
+ *
967
+ * @returns jQuery object which contains the values from the API instance's result set.
968
+ */
969
+ to$(): JQuery;
1155
970
 
1156
- /**
1157
- * Set the search term for the columns from the selector. Note this doesn't actually perform the search.
1158
- *
1159
- * @param input Search string to apply to the selected columns.
1160
- * @param regex Treat as a regular expression (true) or not (default, false).
1161
- * @param smart Perform smart search (default, true) or not (false).
1162
- * @param caseInsen Do case-insensitive matching (default, true) or not (false).
1163
- * @returns DataTables Api instance.
1164
- */
1165
- search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
1166
- }
1167
- //#endregion "column-methods"
971
+ /**
972
+ * Create a native Javascript array object from an API instance.
973
+ *
974
+ * @returns Javascript array which contains the values from the API instance's result set.
975
+ */
976
+ toArray(): any[];
1168
977
 
1169
- //#region "row-methods"
978
+ /**
979
+ * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set.
980
+ *
981
+ * @returns jQuery object which contains the values from the API instance's result set.
982
+ */
983
+ toJQuery(): JQuery;
1170
984
 
1171
- interface CommonRowMethod {
1172
- /**
1173
- * Get the DataTables cached data for the selected row(s)
1174
- *
1175
- * @param type Specify which cache the data should be read from. Can take one of two values: search or order
1176
- * @returns DataTables API instance with data for each cell in the selected row in the result set. This is a 1D array with each entry being the data for the cells from the selected row.
1177
- */
1178
- cache(type: string): Api<Array<any>> | Api <Array<Array<any>>>;
985
+ /**
986
+ * Create a new API instance containing only the unique items from a the elements in an instance's result set.
987
+ *
988
+ * @returns New Api instance which contains the unique items from the original instance's result set, in its own result set.
989
+ */
990
+ unique(): Api<any>;
1179
991
 
1180
- /**
1181
- * Obtain the th / td nodes for the selected row(s)
1182
- *
1183
- * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom'
1184
- */
1185
- invalidate(source?: string): Api<Array<any>>;
1186
- }
992
+ /**
993
+ * Add one or more items to the start of an API instance's result set.
994
+ *
995
+ * @param value_1 Item to add to the API instance's result set.
996
+ * @returns The length of the modified API instance
997
+ */
998
+ unshift(value_1: any, ...value_2: any[]): number;
999
+ }
1187
1000
 
1188
- interface RowChildMethodModel<T> {
1189
- /**
1190
- * Get the child row(s) that have been set for a parent row
1191
- *
1192
- * @returns Query object with the child rows for the parent row in its result set, or undefined if there are no child rows set for the parent yet.
1193
- */
1194
- (): JQuery;
1195
1001
 
1196
- /**
1197
- * Get the child row(s) that have been set for a parent row
1198
- *
1199
- * @param showRemove This parameter can be given as true or false
1200
- * @returns DataTables Api instance.
1201
- */
1202
- (showRemove: boolean): RowChildMethods<T> | Api<T>;
1002
+ export interface ApiSelectorModifier {
1003
+ /**
1004
+ * The order modifier provides the ability to control which order the rows are processed in.
1005
+ * Values: 'current', 'applied', 'index', 'original'
1006
+ */
1007
+ order?: string;
1203
1008
 
1204
- /**
1205
- * 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.
1206
- *
1207
- * @param data The data to be shown in the child row can be given in multiple different ways.
1208
- * @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).
1209
- * @returns DataTables Api instance
1210
- */
1211
- (data: (string | Node | JQuery) | Array<(string | number | JQuery)>, className?: string): RowChildMethods<T> | Api<T>;
1009
+ /**
1010
+ * 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.
1011
+ * Values: 'none', 'applied', 'removed'
1012
+ */
1013
+ search?: string;
1212
1014
 
1213
- /**
1214
- * Hide the child row(s) of a parent row
1215
- *
1216
- * @returns DataTables API instance.
1217
- */
1218
- hide(): Api<any>;
1015
+ /**
1016
+ * The searchPlaceholder modifier provides the ability to provide informational text for an input control when it has no value.
1017
+ */
1018
+ searchPlaceholder?: string;
1219
1019
 
1220
- /**
1221
- * Check if the child rows of a parent row are visible
1222
- *
1223
- * @returns boolean indicating whether the child rows are visible.
1224
- */
1225
- isShown(): boolean;
1020
+ /**
1021
+ * 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.
1022
+ * Values: 'all', 'current'
1023
+ */
1024
+ page?: string;
1025
+ }
1226
1026
 
1227
- /**
1228
- * Remove child row(s) from display and release any allocated memory
1229
- *
1230
- * @returns DataTables API instance.
1231
- */
1232
- remove(): Api<any>;
1027
+ export interface AjaxMethods extends Api<any> {
1028
+ /**
1029
+ * Reload the table data from the Ajax data source.
1030
+ *
1031
+ * @param callback Function which is executed when the data as been reloaded and the table fully redrawn.
1032
+ * @param resetPaging Reset (default action or true) or hold the current paging position (false).
1033
+ * @returns DataTables Api instance
1034
+ */
1035
+ load(callback?: ((json: any) => void), resetPaging?: boolean): Api<any>;
1036
+ }
1233
1037
 
1234
- /**
1235
- * Show the child row(s) of a parent row
1236
- *
1237
- * @returns DataTables API instance.
1238
- */
1239
- show(): Api<any>;
1240
- }
1241
1038
 
1242
- interface RowChildMethods<T> extends CoreMethods<T> {
1243
- /**
1244
- * Hide the child row(s) of a parent row
1245
- *
1246
- * @returns DataTables API instance.
1247
- */
1248
- hide(): Api<any>;
1249
1039
 
1250
- /**
1251
- * Remove child row(s) from display and release any allocated memory
1252
- *
1253
- * @returns DataTables API instance.
1254
- */
1255
- remove(): Api<any>;
1256
1040
 
1257
- /**
1258
- * Make newly defined child rows visible
1259
- *
1260
- * @returns DataTables API instance.
1261
- */
1262
- show(): Api<any>;
1263
- }
1041
+ export interface ApiPageInfo {
1042
+ page: number;
1043
+ pages: number;
1044
+ start: number;
1045
+ end: number;
1046
+ length: number;
1047
+ recordsTotal: number;
1048
+ recordsDisplay: number;
1049
+ serverSide: boolean;
1050
+ }
1264
1051
 
1265
- interface RowMethodsModel<T> {
1266
- /**
1267
- * Select a row found by a row selector
1268
- *
1269
- * @param rowSelector Row selector.
1270
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1271
- * @returns DataTables API instance with selected row in the result set
1272
- */
1273
- (rowSelector: RowSelector<T>, modifier?: ObjectSelectorModifier): RowMethods<T>;
1052
+ export interface State {
1053
+ time: number;
1054
+ start: number;
1055
+ length: number;
1056
+ order: Array<Array<(string | number)>>;
1057
+ search: ConfigSearch;
1058
+ columns: Array<{
1059
+ search: ConfigSearch;
1060
+ visible: boolean;
1061
+ }>;
1062
+ }
1274
1063
 
1275
- /**
1276
- * Add a new row to the table using the given data
1277
- *
1278
- * @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+
1279
- * @returns DataTables API instance with the newly added row in its result set.
1280
- */
1281
- add(data: any[] | object): Api<Array<Array<any>>>;
1282
- }
1064
+ /**
1065
+ * "table" - loop over the context's (i.e. the tables) for the instance
1066
+ *
1067
+ * @param settings Table settings object
1068
+ * @param counter Loop counter
1069
+ */
1070
+ type InteratorTable = (settings: InternalSettings, counter: number) => any;
1283
1071
 
1284
- interface RowMethods<T> extends CoreMethods<T>, CommonRowMethod, APIShowPlugIn{
1285
- /**
1286
- * Order Methods / object
1287
- */
1288
- child: RowChildMethodModel<T>;
1072
+ /**
1073
+ * "cell" - loop over each table and cell in the result set
1074
+ *
1075
+ * @param settings Table settings object
1076
+ * @param rowIndex Row index
1077
+ * @param columnIndex Column index
1078
+ * @param tableCounter Table counter (outer)
1079
+ * @param cellCounter Cell counter (inner)
1080
+ */
1081
+ type InteratorCell = (settings: InternalSettings, rowIndex: number, columnIndex: number, tableCounter: number, cellCounter: number) => any;
1289
1082
 
1290
- /**
1291
- * Get the data for the selected row
1292
- *
1293
- * @returns Data source object for the data source of the row.
1294
- */
1295
- data(): T;
1083
+ /**
1084
+ * "columns" - loop over each item in the result set
1085
+ *
1086
+ * @param settings Table settings object
1087
+ * @param resultItem Result set item
1088
+ * @param counter Loop counter
1089
+ */
1090
+ type InteratorColumns = (settings: InternalSettings, resultItem: any, counter: number) => any;
1296
1091
 
1297
- /**
1298
- * Set the data for the selected row
1299
- *
1300
- * @param d Data to use for the row.
1301
- * @returns DataTables API instance with the row retrieved by the selector in the result set.
1302
- */
1303
- data(d: any[] | object): Api<T>;
1092
+ /**
1093
+ * "column" - loop over each table and column in the result set
1094
+ *
1095
+ * @param settings Table settings object
1096
+ * @param columnIndex Column index
1097
+ * @param tableCounter Table counter (outer)
1098
+ * @param columnCounter Column counter (inner)
1099
+ */
1100
+ type InteratorColumn = (settings: InternalSettings, columnIndex: number, tableCounter: number, columnCounter: number) => any;
1304
1101
 
1305
- /**
1306
- * Get the id of the selected row. Since: 1.10.8
1307
- *
1308
- * @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
1309
- * false - Do not modify the id value.
1310
- * @returns Row id. If the row does not have an id available 'undefined' will be returned.
1311
- */
1312
- id(hash?: boolean): string;
1102
+ /**
1103
+ * "column-rows" - loop over each table, column and row in the result set applying selector-modifier.
1104
+ *
1105
+ * @param settings Table settings object
1106
+ * @param columnIndex Column index
1107
+ * @param tableCounter Table counter (outer)
1108
+ * @param columnCounter Column counter (inner)
1109
+ * @param rowIndexes Row indexes
1110
+ */
1111
+ type InteratorColumnRows = (settings: InternalSettings, columnIndex: number, tableCounter: number, columnCounter: number, rowIndexes: number[]) => any;
1313
1112
 
1314
- /**
1315
- * Get the row index of the row column.
1316
- *
1317
- * @returns Row index
1318
- */
1319
- index(): number;
1113
+ /**
1114
+ * "row" - loop over each table and row in the result set
1115
+ *
1116
+ * @param settings Table settings object
1117
+ * @param rowIndex Row index
1118
+ * @param tableCounter Table counter (outer)
1119
+ * @param rowCounter Row counter (inner)
1120
+ */
1121
+ type InteratorRow = (settings: InternalSettings, rowIndex: number, tableCounter: number, rowCounter: number) => any;
1320
1122
 
1321
- /**
1322
- * Obtain the tr node for the selected row
1323
- *
1324
- * @returns tr element of the selected row or null if the element is not yet available
1325
- */
1326
- node(): Node;
1123
+ /**
1124
+ * "rows" - loop over each item in the result set
1125
+ *
1126
+ * @param settings Table settings object
1127
+ * @param resultItem Result set item
1128
+ * @param counter Loop counter
1129
+ */
1130
+ type InteratorRows = (settings: InternalSettings, resultItem: any, counter: number) => any;
1327
1131
 
1328
- /**
1329
- * Delete the selected row from the DataTable.
1330
- *
1331
- * @returns DataTables API instance with removed row reference in the result set
1332
- */
1333
- remove(): Api<Node>;
1334
- }
1132
+ export interface ApiAjax {
1133
+ /**
1134
+ * Get the latest JSON data obtained from the last Ajax request DataTables made
1135
+ *
1136
+ * @returns JSON object that was last loaded/
1137
+ */
1138
+ json(): object;
1335
1139
 
1336
- interface RowsMethodsModel<T> {
1337
- /**
1338
- * Select all rows
1339
- *
1340
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1341
- * @returns DataTables API instance with selected rows
1342
- */
1343
- (modifier?: ObjectSelectorModifier): RowsMethods<T>;
1140
+ /**
1141
+ * Get the data submitted by DataTables to the server in the last Ajax request
1142
+ *
1143
+ * @returns object containing the data submitted by DataTables
1144
+ */
1145
+ params(): object;
1344
1146
 
1345
- /**
1346
- * Select rows found by a row selector
1347
- *
1348
- * @param cellSelector Row selector.
1349
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1350
- * @returns DataTables API instance with selected rows in the result set
1351
- */
1352
- (rowSelector: RowSelector<T>, modifier?: ObjectSelectorModifier): RowsMethods<T>;
1147
+ /**
1148
+ * Reload the table data from the Ajax data source.
1149
+ *
1150
+ * @param callback Function which is executed when the data as been reloaded and the table fully redrawn.
1151
+ * @param resetPaging Reset (default action or true) or hold the current paging position (false).
1152
+ * @returns DataTables Api
1153
+ */
1154
+ reload(callback?: ((json: any) => void), resetPaging?: boolean): Api<any>;
1353
1155
 
1354
- /**
1355
- * Add new rows to the table using the data given
1356
- *
1357
- * @param data Array of data elements, with each one describing a new row to be added to the table
1358
- * @returns DataTables API instance with the newly added rows in its result set.
1359
- */
1360
- add(data: T[]): Api<Array<any>>;
1361
- }
1156
+ /**
1157
+ * Reload the table data from the Ajax data source
1158
+ *
1159
+ * @returns URL set as the Ajax data source for the table.
1160
+ */
1161
+ url(): string;
1362
1162
 
1363
- interface RowsMethods<T> extends CoreMethods<T>, CommonRowMethod, APIGeneratePlugIn {
1364
- /**
1365
- * Get the data for the selected rows
1366
- *
1367
- * @returns DataTables API instance with data for each row from the selector in the result set.
1368
- */
1369
- data(): Api<T>;
1163
+ /**
1164
+ * Reload the table data from the Ajax data source
1165
+ *
1166
+ * @param url URL to set to be the Ajax data source for the table.
1167
+ * @returns DataTables Api instance for chaining or further ajax.url() methods
1168
+ */
1169
+ url(url: string): AjaxMethods;
1170
+ }
1370
1171
 
1371
- /**
1372
- * Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6
1373
- *
1374
- * @param fn Function to execute for every row selected.
1375
- * @returns DataTables API instance of the selected rows.
1376
- */
1377
- every(fn: (this: RowMethods<T>, rowIdx: number, tableLoop: number, rowLoop: number) => void): Api<any>;
1172
+ export interface ApiPage {
1173
+ /**
1174
+ * Get the current page of the table.
1175
+ *
1176
+ * @returns Currently displayed page number
1177
+ */
1178
+ (): number;
1378
1179
 
1379
- /**
1380
- * Get the ids of the selected rows. Since: 1.10.8
1381
- *
1382
- * @param hash true - Append a hash (#) to the start of each row id. This can be useful for then using the ids as selectors
1383
- * false - Do not modify the id value.
1384
- * @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.
1385
- */
1386
- ids(hash?: boolean): Api<Array<any>>;
1180
+ /**
1181
+ * Set the current page of the table.
1182
+ *
1183
+ * @param page Index or 'first', 'next', 'previous', 'last'
1184
+ * @returns DataTables API instance
1185
+ */
1186
+ (page: number | string): Api<any>;
1387
1187
 
1388
- /**
1389
- * Get the row indexes of the selected rows.
1390
- *
1391
- * @returns DataTables API instance with selected row indexes in the result set.
1392
- */
1393
- indexes(): Api<Array<number>>;
1188
+ /**
1189
+ * Get paging information about the table
1190
+ *
1191
+ * @returns Object with information about the table's paging state.
1192
+ */
1193
+ info(): ApiPageInfo;
1394
1194
 
1395
- /**
1396
- * Obtain the tr nodes for the selected rows
1397
- *
1398
- * @returns DataTables API instance with each row's node from the selected rows in the result set.
1399
- */
1400
- nodes(): Api<Array<Node>>;
1195
+ /**
1196
+ * Get the table's page length.
1197
+ *
1198
+ * @returns Current page length.
1199
+ */
1200
+ len(): number;
1401
1201
 
1402
- /**
1403
- * Delete the selected rows from the DataTable.
1404
- *
1405
- * @returns DataTables API instance with references for the removed rows in the result set
1406
- */
1407
- remove(): Api<Array<any>>;
1408
- }
1409
- //#endregion "row-methods"
1202
+ /**
1203
+ * Set the table's page length.
1204
+ *
1205
+ * @param length Page length to set. use -1 to show all records.
1206
+ * @returns DataTables API instance.
1207
+ */
1208
+ len(length: number): Api<any>;
1209
+ }
1410
1210
 
1411
- //#region "table-methods"
1211
+ export interface ApiOrder {
1212
+ /**
1213
+ * Get the ordering applied to the table.
1214
+ *
1215
+ * @returns Array of arrays containing information about the currently applied sort. This 2D array is the same format as the array used for setting the order to apply to the table
1216
+ */
1217
+ (): Array<Array<(string | number)>>;
1412
1218
 
1413
- interface TableMethods<T> extends CoreMethods<T> {
1414
- /**
1415
- * Get the tfoot node for the table in the API's context
1416
- *
1417
- * @returns HTML tbody node.
1418
- */
1419
- footer(): Node;
1219
+ /**
1220
+ * Set the ordering applied to the table.
1221
+ *
1222
+ * @param order Order Model
1223
+ * @returns DataTables Api instance
1224
+ */
1225
+ (order?: Array<(string | number)> | Array<Array<(string | number)>>): Api<any>;
1226
+ (order: Array<(string | number)>, ...args: any[]): Api<any>;
1420
1227
 
1421
- /**
1422
- * Get the thead node for the table in the API's context
1423
- *
1424
- * @returns HTML thead node.
1425
- */
1426
- header(): Node;
1228
+ /**
1229
+ * Get the fixed ordering that is applied to the table. If there is more than one table in the API's context,
1230
+ * the ordering of the first table will be returned only (use table() if you require the ordering of a different table in the API's context).
1231
+ * @returns object describing the ordering that is applied to the table
1232
+ */
1233
+ fixed(): OrderFixed;
1427
1234
 
1428
- /**
1429
- * Get the tbody node for the table in the API's context
1430
- *
1431
- * @returns HTML tfoot node.
1432
- */
1433
- body(): Node;
1235
+ /**
1236
+ * Set the table's fixed ordering. Note this doesn't actually perform the order, but rather queues it up - use draw() to perform the ordering.
1237
+ *
1238
+ * @param order Used to indicate whether the ordering should be performed before or after the users own ordering.
1239
+ * @returns DataTables Api instance
1240
+ */
1241
+ fixed(order: OrderFixed): Api<any>;
1434
1242
 
1435
- /**
1436
- * Get the div container node for the table in the API's context
1437
- *
1438
- * @returns HTML div node.
1439
- */
1440
- container(): Node;
1243
+ /**
1244
+ * Add an ordering listener to an element, for a given column.
1245
+ *
1246
+ * @param node Selector
1247
+ * @param column Column index
1248
+ * @param callback Callback function
1249
+ * @returns DataTables API instance with the current order in the result set
1250
+ */
1251
+ listener(node: string | Node | JQuery, column: number, callback: (() => void)): Api<any>;
1252
+ }
1441
1253
 
1442
- /**
1443
- * Get the table node for the table in the API's context
1444
- *
1445
- * @returns HTML table node for the selected table.
1446
- */
1447
- node(): Node;
1448
- }
1254
+ export interface ApiState<T> {
1255
+ /**
1256
+ * Get the last saved state of the table
1257
+ *
1258
+ * @returns State saved object
1259
+ */
1260
+ (): State;
1449
1261
 
1450
- interface TablesMethods<T> extends CoreMethods<T> {
1451
- /**
1452
- * Get the tfoot nodes for the tables in the API's context
1453
- *
1454
- * @returns Array of HTML tfoot nodes for all table in the API's context
1455
- */
1456
- footer(): Api<Array<Node>>;
1262
+ /**
1263
+ * Clear the saved state of the table.
1264
+ *
1265
+ * @returns The API instance that was used, available for chaining.
1266
+ */
1267
+ clear(): Api<any>;
1457
1268
 
1458
- /**
1459
- * Get the thead nodes for the tables in the API's context
1460
- *
1461
- * @returns Array of HTML thead nodes for all table in the API's context
1462
- */
1463
- header(): Api<Array<Node>>;
1269
+ /**
1270
+ * Get the table state that was loaded during initialisation.
1271
+ *
1272
+ * @returns State saved object. See state() for the object format.
1273
+ */
1274
+ loaded(): State;
1464
1275
 
1465
- /**
1466
- * Get the tbody nodes for the tables in the API's context
1467
- *
1468
- * @returns Array of HTML tbody nodes for all table in the API's context
1469
- */
1470
- body(): Api<Array<Node>>;
1276
+ /**
1277
+ * Trigger a state save.
1278
+ *
1279
+ * @returns The API instance that was used, available for chaining.
1280
+ */
1281
+ save(): Api<T>;
1282
+ }
1471
1283
 
1472
- /**
1473
- * Get the div container nodes for the tables in the API's context
1474
- *
1475
- * @returns Array of HTML div nodes for all table in the API's context
1476
- */
1477
- containers(): Api<Array<Node>>;
1478
1284
 
1479
- /**
1480
- * Get the table nodes for the tables in the API's context
1481
- *
1482
- * @returns Array of HTML table nodes for all table in the API's context
1483
- */
1484
- nodes(): Api<Array<Node>>;
1485
- }
1486
- //#endregion "table-methods"
1487
1285
 
1488
- //#endregion "Namespaces"
1286
+ export interface ApiCell<T> {
1287
+ /**
1288
+ * Select the cell found by a cell selector
1289
+ *
1290
+ * @param cellSelector Cell selector.
1291
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering
1292
+ * @returns DataTables API instance with selected cell
1293
+ */
1294
+ (cellSelector: CellSelector, modifier?: ApiSelectorModifier): ApiCellMethods<T>;
1489
1295
 
1490
- //#region "Static-Methods"
1296
+ /**
1297
+ * Select the cell found by a cell selector
1298
+ *
1299
+ * @param rowSelector Row selector.
1300
+ * @param columnSelector Column selector.
1301
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering
1302
+ * @returns DataTables API instance with selected cell
1303
+ */
1304
+ (rowSelector: CellSelector, columnSelector: any, modifier?: ApiSelectorModifier): ApiCellMethods<T>;
1305
+ }
1491
1306
 
1492
- interface StaticFunctions {
1493
- /**
1494
- * Check if a table node is a DataTable already or not.
1495
- *
1496
- * Usage:
1497
- * $.fn.dataTable.isDataTable("selector");
1498
- * @param table The table to check.
1499
- * @returns true the given table is a DataTable, false otherwise
1500
- */
1501
- isDataTable(table: string | Node | JQuery | Api<any>): boolean;
1307
+ export interface ApiCellMethods<T> extends Omit<Api<T>, 'render'> {
1308
+ /**
1309
+ * Get the DataTables cached data for the selected cell
1310
+ *
1311
+ * @param type Specify which cache the data should be read from. Can take one of two values: search or order
1312
+ * @returns DataTables API instance with the cached data for each selected cell in the result set
1313
+ */
1314
+ cache(type: string): Api<T>;
1502
1315
 
1503
- /**
1504
- * Helpers for `columns.render`.
1505
- *
1506
- * The options defined here can be used with the `columns.render` initialisation
1507
- * option to provide a display renderer.
1508
- */
1509
- render: StaticRenderFunctions;
1316
+ /**
1317
+ * Get data for the selected cell
1318
+ *
1319
+ * @returns the data from the cell
1320
+ */
1321
+ data(): any;
1510
1322
 
1511
- /**
1512
- * 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.
1513
- *
1514
- * @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).
1515
- * Since 1.10.8 this option can also be given as an object.
1516
- * @returns Array or DataTables API instance containing all matching DataTables
1517
- */
1518
- tables(visible?: boolean | objectTablesStatic): Array<Api<any>>| Api<any>;
1323
+ /**
1324
+ * Get data for the selected cell
1325
+ *
1326
+ * @param data Value to assign to the data for the cell
1327
+ * @returns DataTables Api instance
1328
+ */
1329
+ data(data: any): Api<T>;
1519
1330
 
1520
- /**
1521
- * Version number compatibility check function
1522
- *
1523
- * Usage:
1524
- * $.fn.dataTable.versionCheck("1.10.0");
1525
- * @param version Version string
1526
- * @returns true if this version of DataTables is greater or equal to the required version, or false if this version of DataTales is not suitable
1527
- */
1528
- versionCheck(version: string): boolean;
1331
+ /**
1332
+ * Get index information about the selected cell
1333
+ *
1334
+ * @returns Object with index information for the selected cell.
1335
+ */
1336
+ index(): CellIdxWithVisible;
1529
1337
 
1530
- /**
1531
- * Utils
1532
- */
1533
- util: StaticUtilFunctions;
1338
+ /**
1339
+ * Invalidate the data held in DataTables for the selected cell
1340
+ *
1341
+ * @param source Data source to read the new data from.
1342
+ * @returns DataTables API instance with selected cell references in the result set
1343
+ */
1344
+ invalidate(source?: string): Api<T>;
1534
1345
 
1535
- /**
1536
- * Get DataTable API instance
1537
- *
1538
- * @param table Selector string for table
1539
- */
1540
- Api: new (selector: string | Node | Node[] | JQuery | SettingsLegacy) => Api<any>;
1346
+ /**
1347
+ * Get the DOM element for the selected cell
1348
+ *
1349
+ * @returns The TD / TH cell the selector resolved to
1350
+ */
1351
+ node(): Node;
1541
1352
 
1542
- /**
1543
- * Default Settings
1544
- */
1545
- defaults: Settings;
1353
+ /**
1354
+ * Get data for the selected cell
1355
+ *
1356
+ * @param type Data type to get. This can be one of: 'display', 'filter', 'sort', 'type'
1357
+ * @returns Rendered data for the requested type
1358
+ */
1359
+ render(type: string): any;
1360
+ }
1546
1361
 
1547
- /**
1548
- * Default Settings
1549
- */
1550
- ext: ExtSettings;
1551
- }
1362
+ export interface ApiCells<T> {
1363
+ /**
1364
+ * Select all cells
1365
+ *
1366
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering
1367
+ * @returns DataTables API instance with selected cells
1368
+ */
1369
+ (modifier?: ApiSelectorModifier): ApiCellsMethods<T>;
1552
1370
 
1553
- interface ObjectOrderFixed {
1554
- /**
1555
- * Two-element array:
1556
- * 0: Column index to order upon.
1557
- * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order).
1558
- */
1559
- pre?: any[];
1560
- /**
1561
- * Two-element array:
1562
- * 0: Column index to order upon.
1563
- * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order).
1564
- */
1565
- post?: any[];
1566
- }
1371
+ /**
1372
+ * Select cells found by a cell selector
1373
+ *
1374
+ * @param cellSelector Cell selector.
1375
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering
1376
+ * @returns DataTables API instance with selected cells
1377
+ */
1378
+ (cellSelector: CellSelector, modifier?: ApiSelectorModifier): ApiCellsMethods<T>;
1379
+
1380
+ /**
1381
+ * Select cells found by both row and column selectors
1382
+ *
1383
+ * @param rowSelector Row selector.
1384
+ * @param columnSelector Column selector.
1385
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering
1386
+ * @returns DataTables API instance with selected cells
1387
+ */
1388
+ (rowSelector: RowSelector<T>, columnSelector: CellSelector, modifier?: ApiSelectorModifier): ApiCellsMethods<T>;
1389
+ }
1567
1390
 
1568
- interface StaticRenderFunctions {
1569
- /**
1570
- * Will format numeric data (defined by `columns.data`) for display, retaining the original unformatted data for sorting and filtering.
1571
- *
1572
- * @param thousands Thousands grouping separator.
1573
- * @param decimal Decimal point indicator.
1574
- * @param precision Integer number of decimal points to show.
1575
- * @param prefix Prefix (optional).
1576
- * @param postfix Postfix (/suffix) (optional).
1577
- */
1578
- number(thousands: string, decimal: string, precision: number, prefix?: string, postfix?: string): ObjectColumnRender;
1579
- /**
1580
- * Escape HTML to help prevent XSS attacks. It has no optional parameters.
1581
- */
1582
- text(): ObjectColumnRender;
1583
- }
1391
+ export interface ApiCellsMethods<T> extends Omit<Api<T>, 'data' | 'render'> {
1392
+ /**
1393
+ * Get the DataTables cached data for the selected cells
1394
+ *
1395
+ * @param type Specify which cache the data should be read from. Can take one of two values: search or order
1396
+ * @returns DataTables API instance with the cached data for each selected cell in the result set
1397
+ */
1398
+ cache(type: string): Api<T>;
1584
1399
 
1585
- interface StaticUtilFunctions {
1586
- /**
1587
- * Escape special characters in a regular expression string. Since: 1.10.4
1588
- *
1589
- * @param str String to escape
1590
- * @returns Escaped string
1591
- */
1592
- escapeRegex(str: string): string;
1400
+ /**
1401
+ * Get data for the selected cells
1402
+ *
1403
+ * @returns DataTables API instance with data for each cell in the selected columns in the result set. This is a 1D array with each entry being the data for the cells from the selected column.
1404
+ */
1405
+ data(): Api<Array<T>>;
1593
1406
 
1594
- /**
1595
- * Throttle the calls to a method to reduce call frequency. Since: 1.10.3
1596
- *
1597
- * @param fn Function
1598
- * @param period ms
1599
- * @returns Wrapper function that can be called and will automatically throttle calls to the passed in function to the given period.
1600
- */
1601
- throttle(fn: FunctionThrottle, period?: number): (() => void);
1602
- }
1407
+ /**
1408
+ * Iterate over each selected cell, with the function context set to be the cell in question. Since: DataTables 1.10.6
1409
+ *
1410
+ * @param fn Function to execute for every cell selected.
1411
+ */
1412
+ every(fn: (this: ApiCellsMethods<T>, cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api<any>;
1603
1413
 
1604
- type FunctionThrottle = (data: any) => void;
1414
+ /**
1415
+ * Get index information about the selected cells
1416
+ */
1417
+ indexes(): Api<CellIdxWithVisible>;
1605
1418
 
1606
- interface objectTablesStatic {
1607
- /**
1608
- * Get only visible tables (true) or all tables regardless of visibility (false).
1609
- */
1610
- visible: boolean;
1419
+ /**
1420
+ * Invalidate the data held in DataTables for the selected cells
1421
+ *
1422
+ * @param source Data source to read the new data from.
1423
+ * @returns DataTables API instance with selected cell references in the result set
1424
+ */
1425
+ invalidate(source?: string): Api<T>;
1611
1426
 
1612
- /**
1613
- * Return a DataTables API instance for the selected tables (true) or an array (false).
1614
- */
1615
- api: boolean;
1616
- }
1427
+ /**
1428
+ * Get the DOM elements for the selected cells
1429
+ */
1430
+ nodes(): Api<Node>;
1617
1431
 
1618
- //#endregion "Static-Methods"
1432
+ /**
1433
+ * Get data for the selected cell
1434
+ *
1435
+ * @param type Data type to get. This can be one of: 'display', 'filter', 'sort', 'type'
1436
+ * @returns Rendered data for the requested type
1437
+ */
1438
+ render(type: string): any;
1439
+ }
1619
1440
 
1620
- //#region "Settings"
1621
1441
 
1622
- interface Settings {
1623
- //#region "Features"
1624
1442
 
1625
- /**
1626
- * Feature control DataTables' smart column width handling. Since: 1.10
1627
- */
1628
- autoWidth?: boolean;
1629
1443
 
1630
- /**
1631
- * Feature control deferred rendering for additional speed of initialisation. Since: 1.10
1632
- */
1633
- deferRender?: boolean;
1444
+ export interface ApiColumn {
1445
+ /**
1446
+ * Select the column found by a column selector
1447
+ *
1448
+ * @param cellSelector Cell selector.
1449
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1450
+ */
1451
+ (columnSelector: ColumnSelector, modifier?: ApiSelectorModifier): ApiColumnMethods;
1634
1452
 
1635
- /**
1636
- * Feature control table information display field. Since: 1.10
1637
- */
1638
- info?: boolean;
1453
+ /**
1454
+ * Convert from the input column index type to that required.
1455
+ *
1456
+ * @param type The type on conversion that should take place: 'fromVisible', 'toData', 'fromData', 'toVisible'
1457
+ * @param index The index to be converted
1458
+ * @returns Calculated column index
1459
+ */
1460
+ index(type: string, index: number): number;
1461
+ }
1639
1462
 
1640
- /**
1641
- * Use markup and classes for the table to be themed by jQuery UI ThemeRoller. Since: 1.10
1642
- */
1643
- jQueryUI?: boolean;
1463
+ export interface ApiColumnMethods {
1464
+ /**
1465
+ * Get the DataTables cached data for the selected column(s)
1466
+ *
1467
+ * @param type Specify which cache the data should be read from. Can take one of two values: search or order
1468
+ * @return DataTables Api instance with an caches data for the selected column(s)
1469
+ */
1470
+ cache(type: string): Api<any>;
1644
1471
 
1645
- /**
1646
- * Feature control the end user's ability to change the paging display length of the table. Since: 1.10
1647
- */
1648
- lengthChange?: boolean;
1472
+ /**
1473
+ * Get the data for the cells in the selected column.
1474
+ *
1475
+ * @returns DataTables API instance with data for each cell in the selected columns in the result set. This is a 1D array with each entry being the data for the cells from the selected column.
1476
+ */
1477
+ data(): Api<Array<any>>;
1649
1478
 
1650
- /**
1651
- * Feature control ordering (sorting) abilities in DataTables. Since: 1.10
1652
- */
1653
- ordering?: boolean;
1479
+ /**
1480
+ * Get the data source property for the selected column.
1481
+ *
1482
+ * @returns the data source property
1483
+ */
1484
+ dataSrc(): number | string | (() => string);
1654
1485
 
1655
- /**
1656
- * Enable or disable table pagination. Since: 1.10
1657
- */
1658
- paging?: boolean;
1486
+ /**
1487
+ * Get the footer th / td cell for the selected column(s).
1488
+ *
1489
+ * @returns HTML element for the footer of the column(s)
1490
+ */
1491
+ footer(): HTMLElement;
1659
1492
 
1660
- /**
1661
- * Feature control the processing indicator. Since: 1.10
1662
- */
1663
- processing?: boolean;
1493
+ /**
1494
+ * Get the header th / td cell for a column(s).
1495
+ *
1496
+ * @returns HTML element for the header of the column(s)
1497
+ */
1498
+ header(): HTMLElement;
1664
1499
 
1665
- /**
1666
- * Horizontal scrolling. Since: 1.10
1667
- */
1668
- scrollX?: boolean;
1500
+ /**
1501
+ * Get the column index of the selected column.
1502
+ *
1503
+ * @param type Specify if you want to get the column data index (default) or the visible index (visible).
1504
+ * @returns The column index for the selected column.
1505
+ */
1506
+ index(type?: string): number;
1669
1507
 
1670
- /**
1671
- * Vertical scrolling. Since: 1.10 Exp: "200px"
1672
- */
1673
- scrollY?: string;
1508
+ /**
1509
+ * Obtain the th / td nodes for the selected column
1510
+ *
1511
+ * @returns DataTables API instance with each cell's node from the selected columns in the result set. This is a 1D array with each entry being the node for the cells from the selected column.
1512
+ */
1513
+ nodes(): Api<Array<Node>>;
1674
1514
 
1675
- /**
1676
- * Feature control search (filtering) abilities Since: 1.10
1677
- */
1678
- searching?: boolean;
1515
+ /**
1516
+ * Order the table, in the direction specified, by the column selected by the column() selector.
1517
+ *
1518
+ * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending).
1519
+ * @returns DataTables API instance
1520
+ */
1521
+ order(direction: string): Api<any>;
1679
1522
 
1680
- /**
1681
- * Feature control DataTables' server-side processing mode. Since: 1.10
1682
- */
1683
- serverSide?: boolean;
1523
+ /**
1524
+ * Get the currently applied column search.
1525
+ *
1526
+ * @returns the currently applied column search.
1527
+ */
1528
+ search(): string;
1684
1529
 
1685
- /**
1686
- * State saving - restore table state on page reload. Since: 1.10
1687
- */
1688
- stateSave?: boolean;
1530
+ /**
1531
+ * Set the search term for the matched columns.
1532
+ *
1533
+ * @param input Search string to apply.
1534
+ * @param regex Treat as a regular expression (true) or not (default, false).
1535
+ * @param smart Perform smart search.
1536
+ * @param caseInsen Do case-insensitive matching (default, true) or not (false).
1537
+ * @returns DataTables API instance
1538
+ */
1539
+ search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
1689
1540
 
1690
- //#endregion "Features"
1541
+ /**
1542
+ * Get the visibility of the selected column.
1543
+ *
1544
+ * @returns true if the column is visible, false if it is not.
1545
+ */
1546
+ visible(): boolean;
1691
1547
 
1692
- //#region "Data"
1548
+ /**
1549
+ * Set the visibility of the selected column.
1550
+ *
1551
+ * @param show Specify if the column should be visible (true) or not (false).
1552
+ * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false).
1553
+ * @returns DataTables API instance with selected column in the result set.
1554
+ */
1555
+ visible(show: boolean, redrawCalculations?: boolean): Api<any>;
1556
+ }
1693
1557
 
1694
- /**
1695
- * Load data for the table's content from an Ajax source. Since: 1.10
1696
- */
1697
- ajax?: string | AjaxSettings | FunctionAjax;
1558
+ export interface ApiColumns<T> {
1559
+ /**
1560
+ * Select all columns
1561
+ *
1562
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1563
+ * @returns DataTables API instance with selected columns in the result set.
1564
+ */
1565
+ (modifier?: ApiSelectorModifier): ApiColumnsMethods | Api<Array<any>>;
1566
+
1567
+ /**
1568
+ * Select columns found by a cell selector
1569
+ *
1570
+ * @param cellSelector Cell selector.
1571
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1572
+ * @returns DataTables API instance with selected columns
1573
+ */
1574
+ (columnSelector: ColumnSelector, modifier?: ApiSelectorModifier): ApiColumnsMethods;
1698
1575
 
1699
- /**
1700
- * Data to use as the display data for the table. Since: 1.10
1701
- */
1702
- data?: any[];
1576
+ /**
1577
+ * Recalculate the column widths for layout.
1578
+ *
1579
+ * @returns DataTables API instance.
1580
+ */
1581
+ adjust(): Api<T>;
1582
+ }
1703
1583
 
1704
- //#endregion "Data"
1705
1584
 
1706
- //#region "Options"
1585
+ export interface ApiColumnsMethods {
1586
+ /**
1587
+ * Get the DataTables cached data for the selected columna
1588
+ *
1589
+ * @param type Specify which cache the data should be read from. Can take one of two values: search or order
1590
+ * @return DataTables Api instance with an caches data for the selected columna
1591
+ */
1592
+ cache(type: string): Api<any>;
1707
1593
 
1708
- /**
1709
- * Data to use as the display data for the table. Since: 1.10
1710
- */
1711
- columns?: ColumnSettings[];
1594
+ /**
1595
+ * Obtain the data for the columns from the selector
1596
+ *
1597
+ * @returns DataTables API instance with data for each cell in the selected columns in the result set. This is a 2D array with the top level array entries for each column matched by the columns() selector.
1598
+ */
1599
+ data(): Api<Array<Array<any>>>;
1712
1600
 
1713
- /**
1714
- * Assign a column definition to one or more columns.. Since: 1.10
1715
- */
1716
- columnDefs?: ColumnDefsSettings[];
1601
+ /**
1602
+ * Get the data source property for the selected columns.
1603
+ *
1604
+ * @returns API instance with the result set containing the data source parameters for the selected columns as configured by
1605
+ */
1606
+ dataSrc(): Api<any>;
1717
1607
 
1718
- /**
1719
- * Delay the loading of server-side data until second draw
1720
- */
1721
- deferLoading?: number | number[];
1608
+ /**
1609
+ * Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6
1610
+ *
1611
+ * @param fn Function to execute for every column selected.
1612
+ * @returns DataTables API instance of the selected columns.
1613
+ */
1614
+ every(fn: (this: ApiColumnMethods, colIdx: number, tableLoop: number, colLoop: number) => void): Api<any>;
1722
1615
 
1723
- /**
1724
- * Destroy any existing table matching the selector and replace with the new options. Since: 1.10
1725
- */
1726
- destroy?: boolean;
1616
+ /**
1617
+ * Get the footer th / td cell for the selected columna.
1618
+ *
1619
+ * @returns HTML element for the footer of the columna
1620
+ */
1621
+ footer(): HTMLElement;
1727
1622
 
1728
- /**
1729
- * Initial paging start point. Since: 1.10
1730
- */
1731
- displayStart?: number;
1623
+ /**
1624
+ * Get the column indexes of the selected columns.
1625
+ *
1626
+ * @param type Specify if you want to get the column data index (default) or the visible index (visible).
1627
+ * @returns DataTables API instance with selected columns' indexes in the result set.
1628
+ */
1629
+ indexes(type?: string): Api<Array<number>>;
1732
1630
 
1733
- /**
1734
- * Define the table control elements to appear on the page and in what order. Since: 1.10
1735
- */
1736
- dom?: string;
1631
+ /**
1632
+ * Get the header th / td cell for a columna.
1633
+ *
1634
+ * @returns HTML element for the header of the columna
1635
+ */
1636
+ header(): HTMLElement;
1737
1637
 
1738
- /**
1739
- * Change the options in the page length select list. Since: 1.10
1740
- */
1741
- lengthMenu?: Array<(number | string)> | Array<Array<(number | string)>>;
1638
+ /**
1639
+ * Obtain the th / td nodes for the selected columns
1640
+ *
1641
+ * @returns DataTables API instance with each cell's node from the selected columns in the result set. This is a 2D array with the top level array entries for each column matched by the columns() selector.
1642
+ */
1643
+ nodes(): Api<Array<Array<Node>>>;
1742
1644
 
1743
- /**
1744
- * Control which cell the order event handler will be applied to in a column. Since: 1.10
1745
- */
1746
- orderCellsTop?: boolean;
1645
+ /**
1646
+ * Order the table, in the direction specified, by the columns selected by the column() selector.
1647
+ *
1648
+ * @param direction Direction of sort to apply to the selected columna - desc (descending) or asc (ascending).
1649
+ * @returns DataTables API instance
1650
+ */
1651
+ order(direction: string): Api<any>;
1747
1652
 
1748
- /**
1749
- * Highlight the columns being ordered in the table's body. Since: 1.10
1750
- */
1751
- orderClasses?: boolean;
1653
+ /**
1654
+ * Get the currently applied columns search.
1655
+ *
1656
+ * @returns the currently applied columns search.
1657
+ */
1658
+ search(): Api<Array<string>>;
1752
1659
 
1753
- /**
1754
- * Initial order (sort) to apply to the table. Since: 1.10
1755
- */
1756
- order?: Array<(number | string)> | Array<Array<(number | string)>>;
1660
+ /**
1661
+ * Set the search term for the columns from the selector. Note this doesn't actually perform the search.
1662
+ *
1663
+ * @param input Search string to apply to the selected columns.
1664
+ * @param regex Treat as a regular expression (true) or not (default, false).
1665
+ * @param smart Perform smart search (default, true) or not (false).
1666
+ * @param caseInsen Do case-insensitive matching (default, true) or not (false).
1667
+ * @returns DataTables Api instance.
1668
+ */
1669
+ search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
1757
1670
 
1758
- /**
1759
- * Ordering to always be applied to the table. Since: 1.10
1760
- */
1761
- orderFixed?: Array<(number | string)> | Array<Array<(number | string)>> | object;
1671
+ /**
1672
+ * Get the visibility of the selected columns.
1673
+ *
1674
+ * @returns true if the columns is visible, false if it is not.
1675
+ */
1676
+ visible(): boolean;
1762
1677
 
1763
- /**
1764
- * Multiple column ordering ability control. Since: 1.10
1765
- */
1766
- orderMulti?: boolean;
1678
+ /**
1679
+ * Set the visibility of the selected columns.
1680
+ *
1681
+ * @param show Specify if the columns should be visible (true) or not (false).
1682
+ * @param redrawCalculations Indicate if DataTables should recalculate the columns layout (true - default) or not (false).
1683
+ * @returns DataTables API instance with selected columns in the result set.
1684
+ */
1685
+ visible(show: boolean, redrawCalculations?: boolean): Api<any>;
1686
+ }
1767
1687
 
1768
- /**
1769
- * Change the initial page length (number of rows per page). Since: 1.10
1770
- */
1771
- pageLength?: number;
1772
1688
 
1773
- /**
1774
- * Pagination button display options. Basic Types: numbers (1.10.8) simple, simple_numbers, full, full_numbers
1775
- */
1776
- pagingType?: string;
1689
+ export interface ApiRowChildMethods<T> {
1690
+ /**
1691
+ * Get the child row(s) that have been set for a parent row
1692
+ *
1693
+ * @returns Query object with the child rows for the parent row in its result set, or undefined if there are no child rows set for the parent yet.
1694
+ */
1695
+ (): JQuery;
1777
1696
 
1778
- /**
1779
- * Retrieve an existing DataTables instance. Since: 1.10
1780
- */
1781
- retrieve?: boolean;
1697
+ /**
1698
+ * Get the child row(s) that have been set for a parent row
1699
+ *
1700
+ * @param showRemove This parameter can be given as true or false
1701
+ * @returns DataTables Api instance.
1702
+ */
1703
+ (showRemove: boolean): RowChildMethods<T> | Api<T>;
1782
1704
 
1783
- /**
1784
- * Display component renderer types. Since: 1.10
1785
- */
1786
- renderer?: string | RendererSettings;
1705
+ /**
1706
+ * 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.
1707
+ *
1708
+ * @param data The data to be shown in the child row can be given in multiple different ways.
1709
+ * @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).
1710
+ * @returns DataTables Api instance
1711
+ */
1712
+ (data: (string | Node | JQuery) | Array<(string | number | JQuery)>, className?: string): RowChildMethods<T> | Api<T>;
1787
1713
 
1788
- /**
1789
- * Data property name that DataTables will use to set <tr> element DOM IDs. Since: 1.10.8
1790
- */
1791
- rowId?: string;
1714
+ /**
1715
+ * Hide the child row(s) of a parent row
1716
+ *
1717
+ * @returns DataTables API instance.
1718
+ */
1719
+ hide(): Api<any>;
1792
1720
 
1793
- /**
1794
- * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10
1795
- */
1796
- scrollCollapse?: boolean;
1721
+ /**
1722
+ * Check if the child rows of a parent row are visible
1723
+ *
1724
+ * @returns boolean indicating whether the child rows are visible.
1725
+ */
1726
+ isShown(): boolean;
1797
1727
 
1798
- /**
1799
- * Set an initial filter in DataTables and / or filtering options. Since: 1.10
1800
- */
1801
- search?: SearchSettings | boolean;
1728
+ /**
1729
+ * Remove child row(s) from display and release any allocated memory
1730
+ *
1731
+ * @returns DataTables API instance.
1732
+ */
1733
+ remove(): Api<any>;
1802
1734
 
1803
- /**
1804
- * Set placeholder attribute for input type="text" tag elements. Since: 1.10
1805
- */
1806
- searchPlaceholder?: SearchSettings;
1735
+ /**
1736
+ * Show the child row(s) of a parent row
1737
+ *
1738
+ * @returns DataTables API instance.
1739
+ */
1740
+ show(): Api<any>;
1741
+ }
1807
1742
 
1808
- /**
1809
- * Define an initial search for individual columns. Since: 1.10
1810
- */
1811
- searchCols?: SearchSettings[];
1743
+ export interface RowChildMethods<T> extends Api<T> {
1744
+ /**
1745
+ * Hide the child row(s) of a parent row
1746
+ *
1747
+ * @returns DataTables API instance.
1748
+ */
1749
+ hide(): Api<any>;
1812
1750
 
1813
- /**
1814
- * Set a throttle frequency for searching. Since: 1.10
1815
- */
1816
- searchDelay?: number;
1751
+ /**
1752
+ * Remove child row(s) from display and release any allocated memory
1753
+ *
1754
+ * @returns DataTables API instance.
1755
+ */
1756
+ remove(): Api<any>;
1817
1757
 
1818
- /**
1819
- * Saved state validity duration. Since: 1.10
1820
- */
1821
- stateDuration?: number;
1758
+ /**
1759
+ * Make newly defined child rows visible
1760
+ *
1761
+ * @returns DataTables API instance.
1762
+ */
1763
+ show(): Api<any>;
1764
+ }
1822
1765
 
1823
- /**
1824
- * Set the zebra stripe class names for the rows in the table. Since: 1.10
1825
- */
1826
- stripeClasses?: string[];
1766
+ export interface ApiRow<T> {
1767
+ /**
1768
+ * Select a row found by a row selector
1769
+ *
1770
+ * @param rowSelector Row selector.
1771
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1772
+ * @returns DataTables API instance with selected row in the result set
1773
+ */
1774
+ (rowSelector: RowSelector<T>, modifier?: ApiSelectorModifier): ApiRowMethods<T>;
1827
1775
 
1828
- /**
1829
- * Tab index control for keyboard navigation. Since: 1.10
1830
- */
1831
- tabIndex?: number;
1776
+ /**
1777
+ * Add a new row to the table using the given data
1778
+ *
1779
+ * @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+
1780
+ * @returns DataTables API instance with the newly added row in its result set.
1781
+ */
1782
+ add(data: any[] | object): Api<Array<Array<any>>>;
1783
+ }
1832
1784
 
1833
- /**
1834
- * Enable or disable datatables responsive. Since: 1.10
1835
- */
1836
- responsive?: boolean | object;
1785
+ export interface ApiRowMethods<T> extends Omit<Api<T>, 'data'> {
1786
+ /**
1787
+ * Get the DataTables cached data for the selected row(s)
1788
+ *
1789
+ * @param type Specify which cache the data should be read from. Can take one of two values: search or order
1790
+ * @returns DataTables API instance with data for each cell in the selected row in the result set. This is a 1D array with each entry being the data for the cells from the selected row.
1791
+ */
1792
+ cache(type: string): Api<Array<any>> | Api <Array<Array<any>>>;
1837
1793
 
1838
- //#endregion "Options"
1794
+ /**
1795
+ * Order Methods / object
1796
+ */
1797
+ child: ApiRowChildMethods<T>;
1839
1798
 
1840
- //#region "Callbacks"
1799
+ /**
1800
+ * Get the data for the selected row
1801
+ *
1802
+ * @returns Data source object for the data source of the row.
1803
+ */
1804
+ data(): T;
1841
1805
 
1842
- /**
1843
- * Callback for whenever a TR element is created for the table's body. Since: 1.10
1844
- */
1845
- createdRow?: FunctionCreateRow;
1806
+ /**
1807
+ * Set the data for the selected row
1808
+ *
1809
+ * @param d Data to use for the row.
1810
+ * @returns DataTables API instance with the row retrieved by the selector in the result set.
1811
+ */
1812
+ data(d: any[] | object): Api<T>;
1846
1813
 
1847
- /**
1848
- * Function that is called every time DataTables performs a draw. Since: 1.10
1849
- */
1850
- drawCallback?: FunctionDrawCallback;
1814
+ /**
1815
+ * Get the id of the selected row. Since: 1.10.8
1816
+ *
1817
+ * @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
1818
+ * false - Do not modify the id value.
1819
+ * @returns Row id. If the row does not have an id available 'undefined' will be returned.
1820
+ */
1821
+ id(hash?: boolean): string;
1851
1822
 
1852
- /**
1853
- * Footer display callback function. Since: 1.10
1854
- */
1855
- footerCallback?: FunctionFooterCallback;
1823
+ /**
1824
+ * Get the row index of the row column.
1825
+ *
1826
+ * @returns Row index
1827
+ */
1828
+ index(): number;
1856
1829
 
1857
- /**
1858
- * Number formatting callback function. Since: 1.10
1859
- */
1860
- formatNumber?: FunctionFormatNumber;
1830
+ /**
1831
+ * Obtain the th / td nodes for the selected row(s)
1832
+ *
1833
+ * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom'
1834
+ */
1835
+ invalidate(source?: string): Api<Array<any>>;
1861
1836
 
1862
- /**
1863
- * Header display callback function. Since: 1.10
1864
- */
1865
- headerCallback?: FunctionHeaderCallback;
1837
+ /**
1838
+ * Obtain the tr node for the selected row
1839
+ *
1840
+ * @returns tr element of the selected row or null if the element is not yet available
1841
+ */
1842
+ node(): Node;
1866
1843
 
1867
- /**
1868
- * Table summary information display callback. Since: 1.10
1869
- */
1870
- infoCallback?: FunctionInfoCallback;
1844
+ /**
1845
+ * Delete the selected row from the DataTable.
1846
+ *
1847
+ * @returns DataTables API instance with removed row reference in the result set
1848
+ */
1849
+ remove(): Api<Node>;
1850
+ }
1871
1851
 
1872
- /**
1873
- * Initialisation complete callback. Since: 1.10
1874
- */
1875
- initComplete?: FunctionInitComplete;
1852
+ export interface ApiRows<T> {
1853
+ /**
1854
+ * Select all rows
1855
+ *
1856
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1857
+ * @returns DataTables API instance with selected rows
1858
+ */
1859
+ (modifier?: ApiSelectorModifier): ApiRowsMethods<T>;
1876
1860
 
1877
- /**
1878
- * Pre-draw callback. Since: 1.10
1879
- */
1880
- preDrawCallback?: FunctionPreDrawCallback;
1861
+ /**
1862
+ * Select rows found by a row selector
1863
+ *
1864
+ * @param cellSelector Row selector.
1865
+ * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1866
+ * @returns DataTables API instance with selected rows in the result set
1867
+ */
1868
+ (rowSelector: RowSelector<T>, modifier?: ApiSelectorModifier): ApiRowsMethods<T>;
1881
1869
 
1882
- /**
1883
- * Row draw callback.. Since: 1.10
1884
- */
1885
- rowCallback?: FunctionRowCallback;
1870
+ /**
1871
+ * Add new rows to the table using the data given
1872
+ *
1873
+ * @param data Array of data elements, with each one describing a new row to be added to the table
1874
+ * @returns DataTables API instance with the newly added rows in its result set.
1875
+ */
1876
+ add(data: T[]): Api<Array<any>>;
1877
+ }
1886
1878
 
1887
- /**
1888
- * Callback that defines where and how a saved state should be loaded. Since: 1.10
1889
- */
1890
- stateLoadCallback?: FunctionStateLoadCallback;
1879
+ export interface ApiRowsMethods<T> extends Api<T> {
1880
+ /**
1881
+ * Get the DataTables cached data for the selected row(s)
1882
+ *
1883
+ * @param type Specify which cache the data should be read from. Can take one of two values: search or order
1884
+ * @returns DataTables API instance with data for each cell in the selected row in the result set. This is a 1D array with each entry being the data for the cells from the selected row.
1885
+ */
1886
+ cache(type: string): Api<Array<any>> | Api <Array<Array<any>>>;
1891
1887
 
1892
- /**
1893
- * State loaded callback. Since: 1.10
1894
- */
1895
- stateLoaded?: FunctionStateLoaded;
1888
+ /**
1889
+ * Get the data for the selected rows
1890
+ *
1891
+ * @returns DataTables API instance with data for each row from the selector in the result set.
1892
+ */
1893
+ data(): Api<T>;
1896
1894
 
1897
- /**
1898
- * State loaded - data manipulation callback. Since: 1.10
1899
- */
1900
- stateLoadParams?: FunctionStateLoadParams;
1895
+ /**
1896
+ * Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6
1897
+ *
1898
+ * @param fn Function to execute for every row selected.
1899
+ * @returns DataTables API instance of the selected rows.
1900
+ */
1901
+ every(fn: (this: ApiRowMethods<T>, rowIdx: number, tableLoop: number, rowLoop: number) => void): Api<any>;
1901
1902
 
1902
- /**
1903
- * Callback that defines how the table state is stored and where. Since: 1.10
1904
- */
1905
- stateSaveCallback?: FunctionStateSaveCallback;
1903
+ /**
1904
+ * Get the ids of the selected rows. Since: 1.10.8
1905
+ *
1906
+ * @param hash true - Append a hash (#) to the start of each row id. This can be useful for then using the ids as selectors
1907
+ * false - Do not modify the id value.
1908
+ * @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.
1909
+ */
1910
+ ids(hash?: boolean): Api<Array<any>>;
1906
1911
 
1907
- /**
1908
- * State save - data manipulation callback. Since: 1.10
1909
- */
1910
- stateSaveParams?: FunctionStateSaveParams;
1912
+ /**
1913
+ * Get the row indexes of the selected rows.
1914
+ *
1915
+ * @returns DataTables API instance with selected row indexes in the result set.
1916
+ */
1917
+ indexes(): Api<Array<number>>;
1911
1918
 
1912
- //#endregion "Callbacks"
1919
+ /**
1920
+ * Obtain the th / td nodes for the selected row(s)
1921
+ *
1922
+ * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom'
1923
+ */
1924
+ invalidate(source?: string): Api<Array<any>>;
1913
1925
 
1914
- //#region "Language"
1926
+ /**
1927
+ * Obtain the tr nodes for the selected rows
1928
+ *
1929
+ * @returns DataTables API instance with each row's node from the selected rows in the result set.
1930
+ */
1931
+ nodes(): Api<Array<Node>>;
1915
1932
 
1916
- language?: LanguageSettings;
1933
+ /**
1934
+ * Delete the selected rows from the DataTable.
1935
+ *
1936
+ * @returns DataTables API instance with references for the removed rows in the result set
1937
+ */
1938
+ remove(): Api<Array<any>>;
1939
+ }
1917
1940
 
1918
- //#endregion "Language"
1919
- }
1920
1941
 
1921
- //#region "ajax-settings"
1942
+ export interface ApiTableMethods<T> extends Api<T> {
1943
+ /**
1944
+ * Get the tfoot node for the table in the API's context
1945
+ *
1946
+ * @returns HTML tbody node.
1947
+ */
1948
+ footer(): Node;
1922
1949
 
1923
- interface AjaxDataRequest {
1924
- draw: number;
1925
- start: number;
1926
- length: number;
1927
- data: any;
1928
- order: AjaxDataRequestOrder[];
1929
- columns: AjaxDataRequestColumn[];
1930
- search: AjaxDataRequestSearch;
1931
- }
1950
+ /**
1951
+ * Get the thead node for the table in the API's context
1952
+ *
1953
+ * @returns HTML thead node.
1954
+ */
1955
+ header(): Node;
1932
1956
 
1933
- interface AjaxDataRequestSearch {
1934
- value: string;
1935
- regex: boolean;
1936
- }
1957
+ /**
1958
+ * Get the tbody node for the table in the API's context
1959
+ *
1960
+ * @returns HTML tfoot node.
1961
+ */
1962
+ body(): Node;
1937
1963
 
1938
- interface AjaxDataRequestOrder {
1939
- column: number;
1940
- dir: string;
1941
- }
1964
+ /**
1965
+ * Get the div container node for the table in the API's context
1966
+ *
1967
+ * @returns HTML div node.
1968
+ */
1969
+ container(): Node;
1942
1970
 
1943
- interface AjaxDataRequestColumn {
1944
- data: string | number;
1945
- name: string;
1946
- searchable: boolean;
1947
- orderable: boolean;
1948
- search: AjaxDataRequestSearch;
1949
- }
1971
+ /**
1972
+ * Get the table node for the table in the API's context
1973
+ *
1974
+ * @returns HTML table node for the selected table.
1975
+ */
1976
+ node(): Node;
1977
+ }
1950
1978
 
1951
- interface AjaxData {
1952
- draw?: number;
1953
- recordsTotal?: number;
1954
- recordsFiltered?: number;
1955
- data: any;
1956
- error?: string;
1957
- }
1979
+ export interface ApiTablesMethods<T> extends Api<T> {
1980
+ /**
1981
+ * Get the tfoot nodes for the tables in the API's context
1982
+ *
1983
+ * @returns Array of HTML tfoot nodes for all table in the API's context
1984
+ */
1985
+ footer(): Api<Array<Node>>;
1958
1986
 
1959
- interface AjaxSettings extends JQueryAjaxSettings {
1960
- /**
1961
- * Add or modify data submitted to the server upon an Ajax request. Since: 1.10
1962
- */
1963
- data?: object | FunctionAjaxData;
1987
+ /**
1988
+ * Get the thead nodes for the tables in the API's context
1989
+ *
1990
+ * @returns Array of HTML thead nodes for all table in the API's context
1991
+ */
1992
+ header(): Api<Array<Node>>;
1964
1993
 
1965
- /**
1966
- * Data property or manipulation method for table data. Since: 1.10
1967
- */
1968
- dataSrc?: string | ((data: any) => any[]);
1969
- }
1994
+ /**
1995
+ * Get the tbody nodes for the tables in the API's context
1996
+ *
1997
+ * @returns Array of HTML tbody nodes for all table in the API's context
1998
+ */
1999
+ body(): Api<Array<Node>>;
1970
2000
 
1971
- type FunctionAjax = (data: object, callback: ((data: any) => void), settings: SettingsLegacy) => void;
2001
+ /**
2002
+ * Get the div container nodes for the tables in the API's context
2003
+ *
2004
+ * @returns Array of HTML div nodes for all table in the API's context
2005
+ */
2006
+ containers(): Api<Array<Node>>;
1972
2007
 
1973
- type FunctionAjaxData = (data: object, settings: Settings) => string | object;
2008
+ /**
2009
+ * Get the table nodes for the tables in the API's context
2010
+ *
2011
+ * @returns Array of HTML table nodes for all table in the API's context
2012
+ */
2013
+ nodes(): Api<Array<Node>>;
2014
+ }
1974
2015
 
1975
- //#endregion "ajax-settings"
1976
2016
 
1977
- //#region "colunm-settings"
1978
2017
 
1979
- interface ColumnSettings {
1980
- /**
1981
- * Set the column's aria-label title. Since: 1.10.25
1982
- */
1983
- ariaTitle?: string;
1984
2018
 
1985
- /**
1986
- * Cell type to be created for a column. th/td Since: 1.10
1987
- */
1988
- cellType?: string;
1989
2019
 
1990
- /**
1991
- * Class to assign to each cell in the column. Since: 1.10
1992
- */
1993
- className?: string;
1994
2020
 
1995
- /**
1996
- * Add padding to the text content used when calculating the optimal with for a table. Since: 1.10
1997
- */
1998
- contentPadding?: string;
1999
2021
 
2000
- /**
2001
- * Cell created callback to allow DOM manipulation. Since: 1.10
2002
- */
2003
- createdCell?: FunctionColumnCreatedCell;
2004
2022
 
2005
- /**
2006
- * Class to assign to each cell in the column. Since: 1.10
2007
- */
2008
- data?: number | string | ObjectColumnData | FunctionColumnData | null;
2009
2023
 
2010
- /**
2011
- * Set default, static, content for a column. Since: 1.10
2012
- */
2013
- defaultContent?: string;
2014
2024
 
2015
- /**
2016
- * Set a descriptive name for a column. Since: 1.10
2017
- */
2018
- name?: string;
2019
2025
 
2020
- /**
2021
- * Enable or disable ordering on this column. Since: 1.10
2022
- */
2023
- orderable?: boolean;
2024
2026
 
2025
- /**
2026
- * Define multiple column ordering as the default order for a column. Since: 1.10
2027
- */
2028
- orderData?: number | number[];
2029
2027
 
2030
- /**
2031
- * Live DOM sorting type assignment. Since: 1.10
2032
- */
2033
- orderDataType?: string;
2034
2028
 
2035
- /**
2036
- * Ordering to always be applied to the table. Since 1.10
2037
- *
2038
- * Array type is prefix ordering only and is a two-element array:
2039
- * 0: Column index to order upon.
2040
- * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order).
2041
- */
2042
- orderFixed?: any[] | ObjectOrderFixed;
2043
2029
 
2044
- /**
2045
- * Order direction application sequence. Since: 1.10
2046
- */
2047
- orderSequence?: string[];
2048
2030
 
2049
- /**
2050
- * Render (process) the data for use in the table. Since: 1.10
2051
- */
2052
- render?: number | string | ObjectColumnData | FunctionColumnRender | ObjectColumnRender;
2053
2031
 
2054
- /**
2055
- * Enable or disable filtering on the data in this column. Since: 1.10
2056
- */
2057
- searchable?: boolean;
2058
2032
 
2059
- /**
2060
- * Set the column title. Since: 1.10
2061
- */
2062
- title?: string;
2033
+ export interface ApiStatic {
2034
+ /**
2035
+ * Check if a table node is a DataTable already or not.
2036
+ *
2037
+ * Usage:
2038
+ * $.fn.dataTable.isDataTable("selector");
2039
+ * @param table The table to check.
2040
+ * @returns true the given table is a DataTable, false otherwise
2041
+ */
2042
+ isDataTable(table: string | Node | JQuery | Api<any>): boolean;
2063
2043
 
2064
- /**
2065
- * Set the column type - used for filtering and sorting string processing. Since: 1.10
2066
- */
2067
- type?: string;
2044
+ /**
2045
+ * Helpers for `columns.render`.
2046
+ *
2047
+ * The options defined here can be used with the `columns.render` initialisation
2048
+ * option to provide a display renderer.
2049
+ */
2050
+ render: ApiStaticRender;
2068
2051
 
2052
+ /**
2053
+ * 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.
2054
+ *
2055
+ * @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).
2056
+ * Since 1.10.8 this option can also be given as an object.
2057
+ * @returns Array or DataTables API instance containing all matching DataTables
2058
+ */
2059
+ tables(visible?: {
2069
2060
  /**
2070
- * Enable or disable the display of this column. Since: 1.10
2061
+ * Get only visible tables (true) or all tables regardless of visibility (false).
2071
2062
  */
2072
- visible?: boolean;
2073
-
2063
+ visible: boolean;
2064
+
2074
2065
  /**
2075
- * Column width assignment. Since: 1.10
2066
+ * Return a DataTables API instance for the selected tables (true) or an array (false).
2076
2067
  */
2077
- width?: string;
2078
- }
2068
+ api: boolean;
2069
+ } | boolean): Array<Api<any>>| Api<any>;
2079
2070
 
2080
- interface ColumnDefsSettings extends ColumnSettings {
2081
- targets: string | number | Array<(number | string)>;
2082
- }
2071
+ /**
2072
+ * Version number compatibility check function
2073
+ *
2074
+ * Usage:
2075
+ * $.fn.dataTable.versionCheck("1.10.0");
2076
+ * @param version Version string
2077
+ * @returns true if this version of DataTables is greater or equal to the required version, or false if this version of DataTales is not suitable
2078
+ */
2079
+ versionCheck(version: string): boolean;
2083
2080
 
2084
- type FunctionColumnCreatedCell = (cell: Node, cellData: any, rowData: any, row: number, col: number) => void;
2081
+ /**
2082
+ * Utils
2083
+ */
2084
+ util: ApiStaticUtil;
2085
2085
 
2086
- interface FunctionColumnData {
2087
- (row: any, type: 'set', s: any, meta: CellMetaSettings): void;
2088
- (row: any, type: 'display' | 'sort' | 'filter' | 'type', s: undefined, meta: CellMetaSettings): any;
2089
- }
2086
+ /**
2087
+ * Get DataTable API instance
2088
+ *
2089
+ * @param table Selector string for table
2090
+ */
2091
+ Api: new (selector: string | Node | Node[] | JQuery) => Api<any>;
2090
2092
 
2091
- interface ObjectColumnData {
2092
- _: string | number | FunctionColumnData;
2093
- filter?: string | number | FunctionColumnData;
2094
- display?: string | number | FunctionColumnData;
2095
- type?: string | number | FunctionColumnData;
2096
- sort?: string | number | FunctionColumnData;
2097
- }
2093
+ /**
2094
+ * Default Settings
2095
+ */
2096
+ defaults: Config;
2098
2097
 
2099
- type FunctionColumnRender = (data: any, type: any, row: any, meta: CellMetaSettings) => any;
2098
+ /**
2099
+ * Default Settings
2100
+ */
2101
+ ext: ApiStaticExt;
2102
+ }
2100
2103
 
2101
- interface ObjectColumnRender {
2102
- _?: string | number | FunctionColumnRender;
2103
- filter?: string | number | FunctionColumnRender;
2104
- display?: string | number | FunctionColumnRender;
2105
- type?: string | number | FunctionColumnRender;
2106
- sort?: string | number | FunctionColumnRender;
2107
- }
2104
+ export interface OrderFixed {
2105
+ /**
2106
+ * Two-element array:
2107
+ * 0: Column index to order upon.
2108
+ * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order).
2109
+ */
2110
+ pre?: any[];
2108
2111
 
2109
- interface CellMetaSettings {
2110
- row: number;
2111
- col: number;
2112
- settings: Settings;
2113
- }
2112
+ /**
2113
+ * Two-element array:
2114
+ * 0: Column index to order upon.
2115
+ * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order).
2116
+ */
2117
+ post?: any[];
2118
+ }
2114
2119
 
2115
- //#endregion "colunm-settings"
2120
+ export interface ApiStaticRender {
2121
+ /**
2122
+ * Format an ISO8061 date in auto locale detected format
2123
+ */
2124
+ date(): ObjectColumnRender;
2116
2125
 
2117
- //#region "other-settings"
2126
+ /**
2127
+ * Format an ISO8061 date value using the specified format
2128
+ * @param to Display format
2129
+ * @param locale Locale
2130
+ * @param def Default value if empty
2131
+ */
2132
+ date(to: string, locale?: string): ObjectColumnRender;
2118
2133
 
2119
- interface RendererSettings {
2120
- header?: string;
2121
- pageButton?: string;
2122
- }
2134
+ /**
2135
+ * Format a date value
2136
+ * @param from Data format
2137
+ * @param to Display format
2138
+ * @param locale Locale
2139
+ * @param def Default value if empty
2140
+ */
2141
+ date(from?: string, to?: string, locale?: string, def?: string): ObjectColumnRender;
2123
2142
 
2124
- interface SearchSettings {
2125
- /**
2126
- * Control case-sensitive filtering option. Since: 1.10
2127
- */
2128
- caseInsensitive?: boolean;
2143
+ /**
2144
+ * Format an ISO8061 datetime in auto locale detected format
2145
+ */
2146
+ datetime(): ObjectColumnRender;
2129
2147
 
2130
- /**
2131
- * Enable / disable escaping of regular expression characters in the search term. Since: 1.10
2132
- */
2133
- regex?: boolean;
2148
+ /**
2149
+ * Format an ISO8061 datetime value using the specified format
2150
+ * @param to Display format
2151
+ * @param locale Locale
2152
+ * @param def Default value if empty
2153
+ */
2154
+ datetime(to: string, locale?: string): ObjectColumnRender;
2134
2155
 
2135
- /**
2136
- * Enable / disable DataTables' smart filtering. Since: 1.10
2137
- */
2138
- smart?: boolean;
2156
+ /**
2157
+ * Format a datetime value
2158
+ * @param from Data format
2159
+ * @param to Display format
2160
+ * @param locale Locale
2161
+ * @param def Default value if empty
2162
+ */
2163
+ datetime(from?: string, to?: string, locale?: string, def?: string): ObjectColumnRender;
2139
2164
 
2140
- /**
2141
- * Set an initial filtering condition on the table. Since: 1.10
2142
- */
2143
- search?: string;
2165
+ /**
2166
+ * Render a number with auto-detected locale thousands and decimal
2167
+ */
2168
+ number(): ObjectColumnRender;
2144
2169
 
2145
- /**
2146
- * Set a placeholder attribute for input type="text" tag elements. Since: 1.10.1
2147
- */
2148
- searchPlaceholder?: string;
2149
- }
2170
+ /**
2171
+ * Will format numeric data (defined by `columns.data`) for display, retaining the original unformatted data for sorting and filtering.
2172
+ *
2173
+ * @param thousands Thousands grouping separator. `null` for auto locale
2174
+ * @param decimal Decimal point indicator. `null` for auto locale
2175
+ * @param precision Integer number of decimal points to show.
2176
+ * @param prefix Prefix (optional).
2177
+ * @param postfix Postfix (/suffix) (optional).
2178
+ */
2179
+ number(thousands: string | null, decimal: string | null, precision: number, prefix?: string, postfix?: string): ObjectColumnRender;
2150
2180
 
2151
- //#endregion "other-settings"
2181
+ /**
2182
+ * Escape HTML to help prevent XSS attacks. It has no optional parameters.
2183
+ */
2184
+ text(): ObjectColumnRender;
2152
2185
 
2153
- //#region "callback-functions"
2186
+ /**
2187
+ * Format an ISO8061 date in auto locale detected format
2188
+ */
2189
+ time(): ObjectColumnRender;
2154
2190
 
2155
- type FunctionCreateRow = (row: Node, data: any[] | object, dataIndex: number) => void;
2191
+ /**
2192
+ * Format an ISO8061 time value using the specified format
2193
+ * @param to Display format
2194
+ * @param locale Locale
2195
+ * @param def Default value if empty
2196
+ */
2197
+ time(to: string, locale?: string): ObjectColumnRender;
2156
2198
 
2157
- type FunctionDrawCallback = (settings: SettingsLegacy) => void;
2199
+ /**
2200
+ * Format a time value
2201
+ * @param from Data format
2202
+ * @param to Display format
2203
+ * @param locale Locale
2204
+ * @param def Default value if empty
2205
+ */
2206
+ time(from?: string, to?: string, locale?: string, def?: string): ObjectColumnRender;
2207
+ }
2158
2208
 
2159
- type FunctionFooterCallback = (tfoot: Node, data: any[], start: number, end: number, display: any[]) => void;
2209
+ export interface ApiStaticUtil {
2210
+ /**
2211
+ * Escape special characters in a regular expression string. Since: 1.10.4
2212
+ *
2213
+ * @param str String to escape
2214
+ * @returns Escaped string
2215
+ */
2216
+ escapeRegex(str: string): string;
2160
2217
 
2161
- type FunctionFormatNumber = (formatNumber: number) => void;
2218
+ /**
2219
+ * Create a read function from a descriptor. Since 1.11
2220
+ * @param source A descriptor that is used to define how to read the data from the source object.
2221
+ */
2222
+ get<T=any, D=any>(source: string | object | Function | null): ((data: D, type: string, val: T, meta: CellMetaSettings) => T);
2162
2223
 
2163
- type FunctionHeaderCallback = (thead: Node, data: any[], start: number, end: number, display: any[]) => void;
2224
+ /**
2225
+ * Create a write function from a descriptor. Since 1.11
2226
+ * @param source A descriptor that is used to define how to write data to a source object
2227
+ */
2228
+ set<T=any, D=any>(source: string | object | Function | null): ((data: D, val: T, meta: CellMetaSettings) => void);
2164
2229
 
2165
- type FunctionInfoCallback = (settings: SettingsLegacy, start: number, end: number, mnax: number, total: number, pre: string) => void;
2230
+ /**
2231
+ * Throttle the calls to a method to reduce call frequency. Since: 1.10.3
2232
+ *
2233
+ * @param fn Function
2234
+ * @param period ms
2235
+ * @returns Wrapper function that can be called and will automatically throttle calls to the passed in function to the given period.
2236
+ */
2237
+ throttle(fn: (data: any) => void, period?: number): (() => void);
2238
+ }
2166
2239
 
2167
- type FunctionInitComplete = (settings: SettingsLegacy, json: object) => void;
2168
2240
 
2169
- type FunctionPreDrawCallback = (settings: SettingsLegacy) => void;
2170
2241
 
2171
- type FunctionRowCallback = (row: Node, data: any[] | object, index: number) => void;
2242
+ export interface AjaxData {
2243
+ draw: number;
2244
+ start: number;
2245
+ length: number;
2246
+ data: any;
2247
+ order: AjaxDataOrder[];
2248
+ columns: AjaxDataColumn[];
2249
+ search: AjaxDataSearch;
2250
+ }
2172
2251
 
2173
- type FunctionStateLoadCallback = (settings: SettingsLegacy) => void;
2252
+ export interface AjaxDataSearch {
2253
+ value: string;
2254
+ regex: boolean;
2255
+ }
2174
2256
 
2175
- type FunctionStateLoaded = (settings: SettingsLegacy, data: object) => void;
2257
+ export interface AjaxDataOrder {
2258
+ column: number;
2259
+ dir: string;
2260
+ }
2176
2261
 
2177
- type FunctionStateLoadParams = (settings: SettingsLegacy, data: object) => void;
2262
+ export interface AjaxDataColumn {
2263
+ data: string | number;
2264
+ name: string;
2265
+ searchable: boolean;
2266
+ orderable: boolean;
2267
+ search: AjaxDataSearch;
2268
+ }
2178
2269
 
2179
- type FunctionStateSaveCallback = (settings: SettingsLegacy, data: object) => void;
2270
+ export interface AjaxResponse {
2271
+ draw?: number;
2272
+ recordsTotal?: number;
2273
+ recordsFiltered?: number;
2274
+ data: any;
2275
+ error?: string;
2276
+ }
2180
2277
 
2181
- type FunctionStateSaveParams = (settings: SettingsLegacy, data: object) => void;
2278
+ interface AjaxSettings extends JQueryAjaxSettings {
2279
+ /**
2280
+ * Add or modify data submitted to the server upon an Ajax request.
2281
+ */
2282
+ data?: object | FunctionAjaxData;
2182
2283
 
2183
- //#endregion "callback-functions"
2284
+ /**
2285
+ * Data property or manipulation method for table data.
2286
+ */
2287
+ dataSrc?: string | ((data: any) => any[]);
2288
+ }
2184
2289
 
2185
- //#region "language-settings"
2290
+ interface FunctionColumnData {
2291
+ (row: any, type: 'set', s: any, meta: CellMetaSettings): void;
2292
+ (row: any, type: 'display' | 'sort' | 'filter' | 'type', s: undefined, meta: CellMetaSettings): any;
2293
+ }
2186
2294
 
2187
- // these are all optional
2188
- interface LanguageSettings {
2189
- emptyTable?: string;
2190
- info?: string;
2191
- infoEmpty?: string;
2192
- infoFiltered?: string;
2193
- infoPostFix?: string;
2194
- decimal?: string;
2195
- thousands?: string;
2196
- lengthMenu?: string;
2197
- loadingRecords?: string;
2198
- processing?: string;
2199
- search?: string;
2200
- searchPlaceholder?: string;
2201
- zeroRecords?: string;
2202
- paginate?: LanguagePaginateSettings;
2203
- aria?: LanguageAriaSettings;
2204
- url?: string;
2205
- }
2295
+ interface ObjectColumnData {
2296
+ _: string | number | FunctionColumnData;
2297
+ filter?: string | number | FunctionColumnData;
2298
+ display?: string | number | FunctionColumnData;
2299
+ type?: string | number | FunctionColumnData;
2300
+ sort?: string | number | FunctionColumnData;
2301
+ }
2206
2302
 
2207
- interface LanguagePaginateSettings {
2208
- first: string;
2209
- last: string;
2210
- next: string;
2211
- previous: string;
2212
- }
2303
+ interface ObjectColumnRender {
2304
+ _?: string | number | FunctionColumnRender;
2305
+ filter?: string | number | FunctionColumnRender;
2306
+ display?: string | number | FunctionColumnRender;
2307
+ type?: string | number | FunctionColumnRender;
2308
+ sort?: string | number | FunctionColumnRender;
2309
+ }
2213
2310
 
2214
- interface LanguageAriaSettings {
2215
- sortAscending: string;
2216
- sortDescending: string;
2217
- paginate?: LanguagePaginateSettings;
2218
- }
2311
+ interface CellMetaSettings {
2312
+ row: number;
2313
+ col: number;
2314
+ settings: InternalSettings;
2315
+ }
2219
2316
 
2220
- //#endregion "language-settings"
2317
+ export interface ApiStaticExt {
2318
+ builder: string;
2319
+ classes: ExtClassesSettings;
2320
+ errMode: string;
2321
+ feature: any[];
2322
+ iApiIndex: number;
2323
+ internal: object;
2324
+ legacy: object;
2325
+ oApi: object;
2326
+ order: object;
2327
+ pager: object;
2328
+ renderer: object;
2329
+ search: any[];
2330
+ selector: object;
2331
+ /**
2332
+ * Type based plug-ins.
2333
+ */
2334
+ type: ExtTypeSettings;
2335
+ }
2221
2336
 
2222
- //#endregion "Settings"
2337
+ /**
2338
+ * Classes used by DataTables. Used for styling integration. Note
2339
+ * that these all use legacy Hungarian notation.
2340
+ */
2341
+ export interface ExtClassesSettings {
2342
+ /**
2343
+ * Default Value:
2344
+ * dataTable
2345
+ */
2346
+ sTable?: string;
2223
2347
 
2224
- //#region "SettingsLegacy"
2348
+ /**
2349
+ * Default Value:
2350
+ * no-footer
2351
+ */
2352
+ sNoFooter?: string;
2225
2353
 
2226
- interface ArrayStringNode {
2227
- [index: string]: Node;
2228
- }
2354
+ /**
2355
+ * Default Value:
2356
+ * paginate_button
2357
+ */
2358
+ sPageButton?: string;
2229
2359
 
2230
- interface SettingsLegacy {
2231
- ajax: any;
2232
- oApi: any;
2233
- oFeatures: FeaturesLegacy;
2234
- oScroll: ScrollingLegacy;
2235
- oLanguage: LanguageLegacy; // | { fnInfoCallback: FunctionInfoCallback; };
2236
- oBrowser: BrowserLegacy;
2237
- aanFeatures: ArrayStringNode[][];
2238
- aoData: RowLegacy[];
2239
- aIds: any;
2240
- aiDisplay: number[];
2241
- aiDisplayMaster: number[];
2242
- aoColumns: ColumnLegacy[];
2243
- aoHeader: any[];
2244
- aoFooter: any[];
2245
- asDataSearch: string[];
2246
- oPreviousSearch: any;
2247
- aoPreSearchCols: any[];
2248
- aaSorting: any[][];
2249
- aaSortingFixed: any[][];
2250
- asStripeClasses: string[];
2251
- asDestroyStripes: string[];
2252
- sDestroyWidth: number;
2253
- aoRowCallback: FunctionRowCallback[];
2254
- aoHeaderCallback: FunctionHeaderCallback[];
2255
- aoFooterCallback: FunctionFooterCallback[];
2256
- aoDrawCallback: FunctionDrawCallback[];
2257
- aoRowCreatedCallback: FunctionCreateRow[];
2258
- aoPreDrawCallback: FunctionPreDrawCallback[];
2259
- aoInitComplete: FunctionInitComplete[];
2260
- aoStateSaveParams: FunctionStateSaveParams[];
2261
- aoStateLoadParams: FunctionStateLoadParams[];
2262
- aoStateLoaded: FunctionStateLoaded[];
2263
- sTableId: string;
2264
- nTable: Node;
2265
- nTHead: Node;
2266
- nTFoot: Node;
2267
- nTBody: Node;
2268
- nTableWrapper: Node;
2269
- bDeferLoading: boolean;
2270
- bInitialized: boolean;
2271
- aoOpenRows: any[];
2272
- sDom: string;
2273
- sPaginationType: string;
2274
- iCookieDuration: number;
2275
- sCookiePrefix: string;
2276
- fnCookieCallback: CookieCallbackLegacy;
2277
- aoStateSave: FunctionStateSaveCallback[];
2278
- aoStateLoad: FunctionStateLoadCallback[];
2279
- oLoadedState: any;
2280
- sAjaxSource: string;
2281
- sAjaxDataProp: string;
2282
- jqXHR: any;
2283
- fnServerData: any;
2284
- aoServerParams: any[];
2285
- sServerMethod: string;
2286
- fnFormatNumber: FunctionFormatNumber;
2287
- aLengthMenu: any[];
2288
- iDraw: number;
2289
- bDrawing: boolean;
2290
- iDrawError: number;
2291
- _iDisplayLength: number;
2292
- _iDisplayStart: number;
2293
- _iDisplayEnd: number;
2294
- _iRecordsTotal: number;
2295
- _iRecordsDisplay: number;
2296
- bJUI: boolean;
2297
- oClasses: any;
2298
- bFiltered: boolean;
2299
- bSorted: boolean;
2300
- bSortCellsTop: boolean;
2301
- oInit: any;
2302
- aoDestroyCallback: any[];
2303
- fnRecordsTotal(): number;
2304
- fnRecordsDisplay(): number;
2305
- fnDisplayEnd(): number;
2306
- oInstance: any;
2307
- sInstance: string;
2308
- iTabIndex: number;
2309
- nScrollHead: Node;
2310
- nScrollFoot: Node;
2311
- rowIdFn(mSource: string | number | (() => void)): (() => void);
2312
- }
2360
+ /**
2361
+ * Default Value:
2362
+ * current
2363
+ */
2364
+ sPageButtonActive?: string;
2313
2365
 
2314
- interface BrowserLegacy {
2315
- barWidth: number;
2316
- bBounding: boolean;
2317
- bScrollbarLeft: boolean;
2318
- bScrollOversize: boolean;
2319
- }
2366
+ /**
2367
+ * Default Value:
2368
+ * disabled
2369
+ */
2370
+ sPageButtonDisabled?: string;
2320
2371
 
2321
- interface FeaturesLegacy {
2322
- bAutoWidth: boolean;
2323
- bDeferRender: boolean;
2324
- bFilter: boolean;
2325
- bInfo: boolean;
2326
- bLengthChange: boolean;
2327
- bPaginate: boolean;
2328
- bProcessing: boolean;
2329
- bServerSide: boolean;
2330
- bSort: boolean;
2331
- bSortClasses: boolean;
2332
- bStateSave: boolean;
2333
- }
2372
+ /**
2373
+ * Default Value:
2374
+ * odd
2375
+ */
2376
+ sStripeOdd?: string;
2334
2377
 
2335
- interface ScrollingLegacy {
2336
- bAutoCss: boolean;
2337
- bCollapse: boolean;
2338
- bInfinite: boolean;
2339
- iBarWidth: number;
2340
- iLoadGap: number;
2341
- sX: string;
2342
- sY: string;
2343
- }
2378
+ /**
2379
+ * Default Value:
2380
+ * even
2381
+ */
2382
+ sStripeEven?: string;
2344
2383
 
2345
- interface RowLegacy {
2346
- nTr: Node;
2347
- _aData: any;
2348
- _aSortData: any[];
2349
- _anHidden: Node[];
2350
- _sRowStripe: string;
2351
- }
2384
+ /**
2385
+ * Default Value:
2386
+ * dataTables_empty
2387
+ */
2388
+ sRowEmpty?: string;
2352
2389
 
2353
- interface ColumnLegacy {
2354
- idx: number;
2355
- aDataSort: any;
2356
- asSorting: string[];
2357
- bSearchable: boolean;
2358
- bSortable: boolean;
2359
- bVisible: boolean;
2360
- _bAutoType: boolean;
2361
- fnCreatedCell: FunctionColumnCreatedCell;
2362
- fnGetData(data: any, specific: string): any;
2363
- fnSetData(data: any, value: any): void;
2364
- mData: any;
2365
- mRender: any;
2366
- nTh: Node;
2367
- nIf: Node;
2368
- sClass: string;
2369
- sContentPadding: string;
2370
- sDefaultContent: string;
2371
- sName: string;
2372
- sSortDataType: string;
2373
- sSortingClass: string;
2374
- sSortingClassJUI: string;
2375
- sTitle: string;
2376
- sType: string;
2377
- sWidth: string;
2378
- sWidthOrig: string;
2379
- }
2390
+ /**
2391
+ * Default Value:
2392
+ * dataTables_wrapper
2393
+ */
2394
+ sWrapper?: string;
2380
2395
 
2381
- type CookieCallbackLegacy = (name: string, data: any, expires: string, path: string, cookie: string) => void;
2382
-
2383
- interface LanguageLegacy {
2384
- oAria?: LanguageAriaLegacy;
2385
- oPaginate?: LanguagePaginateLegacy;
2386
- sEmptyTable?: string;
2387
- sInfo?: string;
2388
- sInfoEmpty?: string;
2389
- sInfoFiltered?: string;
2390
- sInfoPostFix?: string;
2391
- sInfoThousands?: string;
2392
- sLengthMenu?: string;
2393
- sLoadingRecords?: string;
2394
- sProcessing?: string;
2395
- sSearch?: string;
2396
- sUrl?: string;
2397
- sZeroRecords?: string;
2398
- }
2396
+ /**
2397
+ * Default Value:
2398
+ * dataTables_filter
2399
+ */
2400
+ sFilter?: string;
2399
2401
 
2400
- interface LanguageAriaLegacy {
2401
- sSortAscending?: string;
2402
- sSortDescending?: string;
2403
- }
2402
+ /**
2403
+ * Default Value:
2404
+ * dataTables_info
2405
+ */
2406
+ sInfo?: string;
2404
2407
 
2405
- interface LanguagePaginateLegacy {
2406
- sFirst?: string;
2407
- sLast?: string;
2408
- sNext?: string;
2409
- sPrevious?: string;
2410
- }
2411
- //#endregion "SettingsLegacy"
2412
-
2413
- //#region "ext internal"
2414
-
2415
- interface ExtSettings {
2416
- aTypes: any[];
2417
- afnFiltering: any[];
2418
- afnSortData: object;
2419
- aoFeatures: any[];
2420
- builder: string;
2421
- classes: ExtClassesSettings;
2422
- errMode: string;
2423
- feature: any[];
2424
- fnVersionCheck(version: string): string;
2425
- iApiIndex: number;
2426
- internal: object;
2427
- legacy: object;
2428
- oApi: object;
2429
- oJUIClasses: object;
2430
- oPagination: object;
2431
- oSort: object;
2432
- oStdClasses: ExtClassesSettings;
2433
- ofnSearch: object;
2434
- order: object;
2435
- pager: object;
2436
- renderer: object;
2437
- sVersion: string;
2438
- search: any[];
2439
- selector: object;
2440
- /**
2441
- * Type based plug-ins.
2442
- */
2443
- type: ExtTypeSettings;
2444
- }
2408
+ /**
2409
+ * Default Value:
2410
+ * dataTables_paginate paging_
2411
+ */
2412
+ sPaging?: string;
2445
2413
 
2446
- interface ExtClassesSettings {
2447
- /**
2448
- * Default Value:
2449
- * dataTable
2450
- */
2451
- sTable?: string;
2414
+ /**
2415
+ * Default Value:
2416
+ * dataTables_length
2417
+ */
2418
+ sLength?: string;
2452
2419
 
2453
- /**
2454
- * Default Value:
2455
- * no-footer
2456
- */
2457
- sNoFooter?: string;
2420
+ /**
2421
+ * Default Value:
2422
+ * dataTables_processing
2423
+ */
2424
+ sProcessing?: string;
2458
2425
 
2459
- /**
2460
- * Default Value:
2461
- * paginate_button
2462
- */
2463
- sPageButton?: string;
2426
+ /**
2427
+ * Default Value:
2428
+ * sorting_asc
2429
+ */
2430
+ sSortAsc?: string;
2464
2431
 
2465
- /**
2466
- * Default Value:
2467
- * current
2468
- */
2469
- sPageButtonActive?: string;
2432
+ /**
2433
+ * Default Value:
2434
+ * sorting_desc
2435
+ */
2436
+ sSortDesc?: string;
2470
2437
 
2471
- /**
2472
- * Default Value:
2473
- * disabled
2474
- */
2475
- sPageButtonDisabled?: string;
2438
+ /**
2439
+ * Default Value:
2440
+ * sorting
2441
+ */
2442
+ sSortable?: string;
2476
2443
 
2477
- /**
2478
- * Default Value:
2479
- * odd
2480
- */
2481
- sStripeOdd?: string;
2444
+ /**
2445
+ * Default Value:
2446
+ * sorting_asc_disabled
2447
+ */
2448
+ sSortableAsc?: string;
2482
2449
 
2483
- /**
2484
- * Default Value:
2485
- * even
2486
- */
2487
- sStripeEven?: string;
2450
+ /**
2451
+ * Default Value:
2452
+ * sorting_desc_disabled
2453
+ */
2454
+ sSortableDesc?: string;
2488
2455
 
2489
- /**
2490
- * Default Value:
2491
- * dataTables_empty
2492
- */
2493
- sRowEmpty?: string;
2456
+ /**
2457
+ * Default Value:
2458
+ * sorting_disabled
2459
+ */
2460
+ sSortableNone?: string;
2494
2461
 
2495
- /**
2496
- * Default Value:
2497
- * dataTables_wrapper
2498
- */
2499
- sWrapper?: string;
2462
+ /**
2463
+ * Default Value:
2464
+ * sorting_
2465
+ */
2466
+ sSortColumn?: string;
2500
2467
 
2501
- /**
2502
- * Default Value:
2503
- * dataTables_filter
2504
- */
2505
- sFilter?: string;
2468
+ sFilterInput?: string;
2469
+ sLengthSelect?: string;
2506
2470
 
2507
- /**
2508
- * Default Value:
2509
- * dataTables_info
2510
- */
2511
- sInfo?: string;
2471
+ /**
2472
+ * Default Value:
2473
+ * dataTables_scroll
2474
+ */
2475
+ sScrollWrapper?: string;
2512
2476
 
2513
- /**
2514
- * Default Value:
2515
- * dataTables_paginate paging_
2516
- */
2517
- sPaging?: string;
2477
+ /**
2478
+ * Default Value:
2479
+ * dataTables_scrollHead
2480
+ */
2481
+ sScrollHead?: string;
2518
2482
 
2519
- /**
2520
- * Default Value:
2521
- * dataTables_length
2522
- */
2523
- sLength?: string;
2483
+ /**
2484
+ * Default Value:
2485
+ * dataTables_scrollHeadInner
2486
+ */
2487
+ sScrollHeadInner?: string;
2524
2488
 
2525
- /**
2526
- * Default Value:
2527
- * dataTables_processing
2528
- */
2529
- sProcessing?: string;
2489
+ /**
2490
+ * Default Value:
2491
+ * dataTables_scrollBody
2492
+ */
2493
+ sScrollBody?: string;
2530
2494
 
2531
- /**
2532
- * Default Value:
2533
- * sorting_asc
2534
- */
2535
- sSortAsc?: string;
2495
+ /**
2496
+ * Default Value:
2497
+ * dataTables_scrollFoot
2498
+ */
2499
+ sScrollFoot?: string;
2536
2500
 
2537
- /**
2538
- * Default Value:
2539
- * sorting_desc
2540
- */
2541
- sSortDesc?: string;
2501
+ /**
2502
+ * Default Value:
2503
+ * dataTables_scrollFootInner
2504
+ */
2505
+ sScrollFootInner?: string;
2506
+
2507
+ sHeaderTH?: string;
2508
+ sFooterTH?: string;
2509
+ sSortJUIAsc?: string;
2510
+ sSortJUIDesc?: string;
2511
+ sSortJUI?: string;
2512
+ sSortJUIAscAllowed?: string;
2513
+ sSortJUIDescAllowed?: string;
2514
+ sSortJUIWrapper?: string;
2515
+ sSortIcon?: string;
2516
+ sJUIHeader?: string;
2517
+ sJUIFooter?: string;
2518
+ }
2542
2519
 
2543
- /**
2544
- * Default Value:
2545
- * sorting
2546
- */
2547
- sSortable?: string;
2548
2520
 
2549
- /**
2550
- * Default Value:
2551
- * sorting_asc_disabled
2552
- */
2553
- sSortableAsc?: string;
2521
+ export interface ExtTypeSettings {
2522
+ /**
2523
+ * Type detection functions for plug-in development.
2524
+ *
2525
+ * @see https://datatables.net/manual/plug-ins/type-detection
2526
+ */
2527
+ detect: FunctionExtTypeSettingsDetect[];
2554
2528
 
2555
- /**
2556
- * Default Value:
2557
- * sorting_desc_disabled
2558
- */
2559
- sSortableDesc?: string;
2529
+ /**
2530
+ * Type based ordering functions for plug-in development.
2531
+ *
2532
+ * @see https://datatables.net/manual/plug-ins/sorting
2533
+ * @default {}
2534
+ */
2535
+ order: any;
2560
2536
 
2561
- /**
2562
- * Default Value:
2563
- * sorting_disabled
2564
- */
2565
- sSortableNone?: string;
2537
+ /**
2538
+ * Type based search formatting for plug-in development.
2539
+ *
2540
+ * @default {}
2541
+ * @example
2542
+ * $.fn.dataTable.ext.type.search['title-numeric'] = function ( d ) {
2543
+ * return d.replace(/\n/g," ").replace( /<.*?>/g, "" );
2544
+ * }
2545
+ */
2546
+ search: any;
2547
+ }
2566
2548
 
2567
- /**
2568
- * Default Value:
2569
- * sorting_
2570
- */
2571
- sSortColumn?: string;
2549
+ /**
2550
+ * @param data Data from the column cell to be analysed.
2551
+ * @param DataTables settings object.
2552
+ */
2553
+ type FunctionExtTypeSettingsDetect = (data: any, settings: InternalSettings) => (string | null);
2572
2554
 
2573
- sFilterInput?: string;
2574
- sLengthSelect?: string;
2555
+ type FunctionAjax = (data: object, callback: ((data: any) => void), settings: InternalSettings) => void;
2575
2556
 
2576
- /**
2577
- * Default Value:
2578
- * dataTables_scroll
2579
- */
2580
- sScrollWrapper?: string;
2557
+ type FunctionAjaxData = (data: AjaxData, settings: InternalSettings) => string | object;
2581
2558
 
2582
- /**
2583
- * Default Value:
2584
- * dataTables_scrollHead
2585
- */
2586
- sScrollHead?: string;
2559
+ type FunctionColumnRender = (data: any, type: any, row: any, meta: CellMetaSettings) => any;
2587
2560
 
2588
- /**
2589
- * Default Value:
2590
- * dataTables_scrollHeadInner
2591
- */
2592
- sScrollHeadInner?: string;
2561
+ type FunctionColumnCreatedCell = (cell: Node, cellData: any, rowData: any, row: number, col: number) => void;
2593
2562
 
2594
- /**
2595
- * Default Value:
2596
- * dataTables_scrollBody
2597
- */
2598
- sScrollBody?: string;
2563
+ type FunctionCreateRow = (row: Node, data: any[] | object, dataIndex: number, cells: Node[]) => void;
2599
2564
 
2600
- /**
2601
- * Default Value:
2602
- * dataTables_scrollFoot
2603
- */
2604
- sScrollFoot?: string;
2565
+ type FunctionDrawCallback = (settings: InternalSettings) => void;
2605
2566
 
2606
- /**
2607
- * Default Value:
2608
- * dataTables_scrollFootInner
2609
- */
2610
- sScrollFootInner?: string;
2611
-
2612
- sHeaderTH?: string;
2613
- sFooterTH?: string;
2614
- sSortJUIAsc?: string;
2615
- sSortJUIDesc?: string;
2616
- sSortJUI?: string;
2617
- sSortJUIAscAllowed?: string;
2618
- sSortJUIDescAllowed?: string;
2619
- sSortJUIWrapper?: string;
2620
- sSortIcon?: string;
2621
- sJUIHeader?: string;
2622
- sJUIFooter?: string;
2623
- }
2624
- //#endregion "ext internal"
2567
+ type FunctionFooterCallback = (tfoot: Node, data: any[], start: number, end: number, display: any[]) => void;
2625
2568
 
2626
- interface ExtTypeSettings {
2627
- /**
2628
- * Type detection functions for plug-in development.
2629
- *
2630
- * @see https://datatables.net/manual/plug-ins/type-detection
2631
- */
2632
- detect: FunctionExtTypeSettingsDetect[];
2633
- /**
2634
- * Type based ordering functions for plug-in development.
2635
- *
2636
- * @see https://datatables.net/manual/plug-ins/sorting
2637
- * @default {}
2638
- */
2639
- order: any;
2640
- /**
2641
- * Type based search formatting for plug-in development.
2642
- *
2643
- * @default {}
2644
- * @example
2645
- * $.fn.dataTable.ext.type.search['title-numeric'] = function ( d ) {
2646
- * return d.replace(/\n/g," ").replace( /<.*?>/g, "" );
2647
- * }
2648
- */
2649
- search: any;
2650
- }
2569
+ type FunctionFormatNumber = (formatNumber: number) => void;
2651
2570
 
2652
- interface APIPlugIns {
2653
- /**
2654
- * Plug-in to average the values in a data set.
2655
- *
2656
- * @returns number representing the average
2657
- */
2658
- average(): number;
2659
- }
2571
+ type FunctionHeaderCallback = (thead: Node, data: any[], start: number, end: number, display: any[]) => void;
2660
2572
 
2661
- interface APIShowPlugIn {
2573
+ type FunctionInfoCallback = (settings: InternalSettings, start: number, end: number, mnax: number, total: number, pre: string) => void;
2662
2574
 
2663
- /**
2664
- * This plugin permits to show the right page of DataTable to show the selected row
2665
- *
2666
- * @author Edouard Labre
2667
- * @returns Api instance for chaining
2668
- */
2669
- show(): Api<any>;
2670
- }
2575
+ type FunctionInitComplete = (settings: InternalSettings, json: object) => void;
2671
2576
 
2672
- interface APITitlePlugIn {
2673
- /**
2674
- * Plug-in to get the title of a column
2675
- *
2676
- * @author Alejandro Navarro
2677
- * @returns string representing the column title
2678
- */
2679
- title(): string;
2680
- }
2577
+ type FunctionPreDrawCallback = (settings: InternalSettings) => void;
2681
2578
 
2682
- interface APINeutralPlugIn {
2683
- /**
2684
- * Plug-in to change ordering of the table to its data load order
2685
- *
2686
- * @returns Api for chaining
2687
- */
2688
- neutral(): Api<any>;
2689
- }
2579
+ type FunctionRowCallback = (row: Node, data: any[] | object, index: number) => void;
2690
2580
 
2691
- interface APIOrderPlugIn {
2692
- /**
2693
- * Plug-in to apply multi-column ordering through the columns() API method.
2694
- *
2695
- * @param dir String or String[] to set the order for the column or columns.
2696
- * @returns Api instance for chaining
2697
- */
2698
- order(dir: string | string[]): Api<any>;
2699
- }
2581
+ type FunctionStateLoadCallback = (settings: InternalSettings) => void;
2700
2582
 
2701
- interface APIGeneratePlugIn {
2702
- /**
2703
- * Plug-in to create tr elements for rows which have not yet had their nodes created
2704
- *
2705
- * @returns Iterator to create tr elements
2706
- */
2707
- generate(): Iterator<Api<any>, Node, Api<any>>;
2708
- }
2583
+ type FunctionStateLoaded = (settings: InternalSettings, data: object) => void;
2709
2584
 
2710
- interface APIJumpToDataPlugIn {
2711
- /**
2712
- * Jump to a page by searching for data from a column
2713
- *
2714
- * @param data The data to be located
2715
- * @param column Column Selector
2716
- */
2717
- jumpToData(data: any, column: any): Api<any>;
2718
- }
2585
+ type FunctionStateLoadParams = (settings: InternalSettings, data: object) => void;
2719
2586
 
2720
- /**
2721
- * @param data Data from the column cell to be analysed.
2722
- * @param DataTables settings object.
2723
- */
2724
- type FunctionExtTypeSettingsDetect = (data: any, settings: Settings) => (string | null);
2725
- }
2587
+ type FunctionStateSaveCallback = (settings: InternalSettings, data: object) => void;
2588
+
2589
+ type FunctionStateSaveParams = (settings: InternalSettings, data: object) => void;