datatables.net 1.13.8 → 2.0.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
@@ -13,8 +13,13 @@
13
13
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
14
14
  * Types
15
15
  */
16
- // No publicly documented properties
17
- type InternalSettings = Object;
16
+
17
+ /**
18
+ * DataTable's internal settings object. DO NOT USE! The parameters
19
+ * in this object are considered private. They can, do, and will
20
+ * change! Always use the API methods for manipulating the table.
21
+ */
22
+ export type InternalSettings = {[key: string]: any};
18
23
 
19
24
  export type DomSelector =
20
25
  string |
@@ -62,6 +67,124 @@ export type CellIdxWithVisible = {
62
67
  columnVisible: number;
63
68
  }
64
69
 
70
+ export type SearchInput<T> = string | RegExp | ((data: string, rowData: T) => boolean);
71
+ export type SearchInputColumn<T> = string | RegExp | ((data: string, rowData: T, column: number) => boolean);
72
+
73
+ export type HeaderStructure = {
74
+ cell: HTMLElement;
75
+ colspan: number;
76
+ rowspan: number;
77
+ title: string;
78
+ }
79
+
80
+ /**
81
+ * DataTables search options.
82
+ *
83
+ * @see https://datatables.net/reference/type/DataTables.SearchOptions
84
+ */
85
+ export interface SearchOptions {
86
+ /** Match from the start of words (ASCII) */
87
+ boundary?: boolean,
88
+
89
+ /** Case insensitive search */
90
+ caseInsensitive?: boolean,
91
+
92
+ /** Exact matching */
93
+ exact?: boolean,
94
+
95
+ /** Treat the input as regex (true) or not (false) */
96
+ regex?: boolean,
97
+
98
+ /** Use DataTables smart search */
99
+ smart?: boolean
100
+ }
101
+
102
+ export interface OrderIdx {
103
+ idx: number;
104
+ dir: 'asc' | 'desc';
105
+ }
106
+
107
+ export interface OrderName {
108
+ name: string;
109
+ dir: 'asc' | 'desc';
110
+ }
111
+
112
+ export type OrderArray = [number, 'asc' | 'desc'];
113
+
114
+ export type OrderCombined = OrderIdx | OrderName | OrderArray;
115
+
116
+ export type Order = OrderCombined | OrderCombined[];
117
+
118
+ export interface DataType {
119
+ className?: string;
120
+ detect?: ((data: any) => string);
121
+ order?: {
122
+ pre?: ((a: any, b: any) => number);
123
+ asc?: ((a: any, b: any) => number);
124
+ desc?: ((a: any, b: any) => number);
125
+ }
126
+ render?: ((data: any, type: string, row: any) => string | number | HTMLElement);
127
+ search?: ((data: any) => string);
128
+ }
129
+
130
+ export interface Feature {
131
+ /** Table information display */
132
+ info?: {
133
+ /** Information display callback */
134
+ callback?: (settings: InternalSettings, start: number, end: number, max: number, total: number, pre: string) => string;
135
+
136
+ /** Empty table text */
137
+ empty?: string;
138
+
139
+ /** Information string postfix */
140
+ postfix?: string;
141
+
142
+ /** Appended to the info string when searching is active */
143
+ search?: string;
144
+
145
+ /** Table summary information display string */
146
+ text?: string;
147
+ }
148
+
149
+ /** Paging length control */
150
+ pageLength?: {
151
+ /** Text for page length control */
152
+ menu?: Array<number | {label: string; value: number}>;
153
+
154
+ /** Text for page length control */
155
+ text?: string;
156
+ }
157
+
158
+ /** Pagination buttons */
159
+ paging?: {
160
+ /** Paging button display options */
161
+ type?: 'numbers' | 'simple' | 'simple_numbers' | 'full' | 'full_numbers' | 'first_last_numbers';
162
+
163
+ /** Set the maximum number of paging number buttons */
164
+ numbers?: number;
165
+ }
166
+
167
+ /** Global search input */
168
+ search?: {
169
+ /** Placeholder for the input element */
170
+ placeholder?: string;
171
+
172
+ /** Text for search control */
173
+ text?: string;
174
+ }
175
+ }
176
+
177
+ type LayoutNumber = '' | '1' | '2' | '3' | '4' | '5';
178
+
179
+ type LayoutSide = 'top' | 'bottom';
180
+
181
+ type LayoutEdge = 'Start' | 'End';
182
+
183
+ type LayoutKeys = `${LayoutSide}${LayoutNumber}${LayoutEdge}` | `${LayoutSide}${LayoutNumber}`;
184
+
185
+ type Layout = Partial<Record<LayoutKeys, keyof Feature | Feature | Array<keyof Feature> | Feature[]>>;
186
+
187
+
65
188
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
66
189
  * Main interfaces
67
190
  */
@@ -143,6 +266,12 @@ export interface Config {
143
266
  */
144
267
  autoWidth?: boolean;
145
268
 
269
+ /**
270
+ * Set a `caption` for the table. This can be used to describe the contents
271
+ * of the table to the end user. A caption tag can also be read from HTML.
272
+ */
273
+ caption?: string;
274
+
146
275
  /**
147
276
  * Data to use as the display data for the table.
148
277
  */
@@ -180,6 +309,8 @@ export interface Config {
180
309
 
181
310
  /**
182
311
  * Define the table control elements to appear on the page and in what order.
312
+ *
313
+ * @deprecated Use `layout` instead
183
314
  */
184
315
  dom?: string;
185
316
 
@@ -193,6 +324,11 @@ export interface Config {
193
324
  */
194
325
  language?: ConfigLanguage;
195
326
 
327
+ /**
328
+ *
329
+ */
330
+ layout?: Layout;
331
+
196
332
  /**
197
333
  * Feature control the end user's ability to change the paging display length of the table.
198
334
  */
@@ -216,12 +352,15 @@ export interface Config {
216
352
  /**
217
353
  * Initial order (sort) to apply to the table.
218
354
  */
219
- order?: Array<(number | string)> | Array<Array<(number | string)>>;
355
+ order?: Order | Order[];
220
356
 
221
357
  /**
222
358
  * Ordering to always be applied to the table.
223
359
  */
224
- orderFixed?: Array<(number | string)> | Array<Array<(number | string)>> | object;
360
+ orderFixed?: Order | Order[] | {
361
+ pre?: Order | Order[],
362
+ post: Order | Order[]
363
+ };
225
364
 
226
365
  /**
227
366
  * Feature control ordering (sorting) abilities in DataTables.
@@ -402,6 +541,7 @@ export interface Config {
402
541
 
403
542
  export interface ConfigLanguage {
404
543
  emptyTable?: string;
544
+ entries?: string | object;
405
545
  info?: string;
406
546
  infoEmpty?: string;
407
547
  infoFiltered?: string;
@@ -470,6 +610,11 @@ export interface ConfigColumns {
470
610
  */
471
611
  defaultContent?: string;
472
612
 
613
+ /**
614
+ * Text to display in the table's footer for this column.
615
+ */
616
+ footer?: string;
617
+
473
618
  /**
474
619
  * Set a descriptive name for a column.
475
620
  */
@@ -502,7 +647,7 @@ export interface ConfigColumns {
502
647
  /**
503
648
  * Order direction application sequence.
504
649
  */
505
- orderSequence?: string[];
650
+ orderSequence?: Array<'asc' | 'desc' | ''>;
506
651
 
507
652
  /**
508
653
  * Render (process) the data for use in the table.
@@ -588,7 +733,7 @@ export interface ConfigSearch {
588
733
  * API
589
734
  */
590
735
 
591
- export interface Api<T> {
736
+ export interface Api<T=any> {
592
737
  /**
593
738
  * API should be array-like
594
739
  */
@@ -621,6 +766,23 @@ export interface Api<T> {
621
766
  */
622
767
  any(): boolean;
623
768
 
769
+ /**
770
+ * Get the contents of the `caption` element for the table.
771
+ */
772
+ caption(): string;
773
+
774
+ /**
775
+ * Set the contents of the `-tag caption` element. If the table doesn't have
776
+ * a `-tag caption` element, one will be created automatically.
777
+ *
778
+ * @param string The value to show in the table's `caption` tag.
779
+ * @param side `top` or `bottom` to set where the table will be shown on the
780
+ * table. If not given the previous value will be used (can also be set in
781
+ * CSS).
782
+ * @returns DataTables API instance for chaining.
783
+ */
784
+ caption(set: string, side?: 'top' | 'bottom'): Api<T>;
785
+
624
786
  /**
625
787
  * Cell (single) selector and methods
626
788
  */
@@ -641,7 +803,7 @@ export interface Api<T> {
641
803
  /**
642
804
  * Column Methods / object
643
805
  */
644
- column: ApiColumn;
806
+ column: ApiColumn<T>;
645
807
 
646
808
  /**
647
809
  * Columns Methods / object
@@ -657,6 +819,13 @@ export interface Api<T> {
657
819
  */
658
820
  concat(a: object, ...b: object[]): Api<any>;
659
821
 
822
+ /**
823
+ * The table setting objects that are manipulated by this API instance
824
+ *
825
+ * @private
826
+ */
827
+ context: InternalSettings[],
828
+
660
829
  /**
661
830
  * 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
662
831
  *
@@ -703,6 +872,13 @@ export interface Api<T> {
703
872
  */
704
873
  eq(idx: number): Api<any>;
705
874
 
875
+ /**
876
+ * Show an error message to the end user / developer through the DataTables logging settings.
877
+ *
878
+ * @param msg Error message to show
879
+ */
880
+ error(msg: string): Api<T>;
881
+
706
882
  /**
707
883
  * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass.
708
884
  *
@@ -752,13 +928,13 @@ export interface Api<T> {
752
928
  * @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.
753
929
  * @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.
754
930
  */
755
- iterator(type: 'table', callback: InteratorTable, returns: boolean): Api<any>;
756
- iterator(type: 'cell', callback: InteratorCell, returns: boolean): Api<any>;
757
- iterator(type: 'column-rows', callback: InteratorColumnRows, returns: boolean): Api<any>;
758
- iterator(type: 'column', callback: InteratorColumn, returns: boolean): Api<any>;
759
- iterator(type: 'columns', callback: InteratorColumns, returns: boolean): Api<any>;
760
- iterator(type: 'row', callback: InteratorRow, returns: boolean): Api<any>;
761
- iterator(type: 'rows', callback: InteratorRows, returns: boolean): Api<any>;
931
+ iterator(type: 'table', callback: InteratorTable, returns?: boolean): Api<any>;
932
+ iterator(type: 'cell', callback: InteratorCell, returns?: boolean): Api<any>;
933
+ iterator(type: 'column-rows', callback: InteratorColumnRows, returns?: boolean): Api<any>;
934
+ iterator(type: 'column', callback: InteratorColumn, returns?: boolean): Api<any>;
935
+ iterator(type: 'columns', callback: InteratorColumns, returns?: boolean): Api<any>;
936
+ iterator(type: 'row', callback: InteratorRow, returns?: boolean): Api<any>;
937
+ iterator(type: 'rows', callback: InteratorRows, returns?: boolean): Api<any>;
762
938
 
763
939
  /**
764
940
  * Iterate over a result set of table, row, column or cell indexes
@@ -769,13 +945,13 @@ export interface Api<T> {
769
945
  * @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.
770
946
  * @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.
771
947
  */
772
- iterator(flatten: boolean, type: 'table', callback: InteratorTable, returns: boolean): Api<any>;
773
- iterator(flatten: boolean, type: 'cell', callback: InteratorCell, returns: boolean): Api<any>;
774
- iterator(flatten: boolean, type: 'column-rows', callback: InteratorColumnRows, returns: boolean): Api<any>;
775
- iterator(flatten: boolean, type: 'column', callback: InteratorColumn, returns: boolean): Api<any>;
776
- iterator(flatten: boolean, type: 'columns', callback: InteratorColumns, returns: boolean): Api<any>;
777
- iterator(flatten: boolean, type: 'row', callback: InteratorRow, returns: boolean): Api<any>;
778
- iterator(flatten: boolean, type: 'rows', callback: InteratorRows, returns: boolean): Api<any>;
948
+ iterator(flatten: boolean, type: 'table', callback: InteratorTable, returns?: boolean): Api<any>;
949
+ iterator(flatten: boolean, type: 'cell', callback: InteratorCell, returns?: boolean): Api<any>;
950
+ iterator(flatten: boolean, type: 'column-rows', callback: InteratorColumnRows, returns?: boolean): Api<any>;
951
+ iterator(flatten: boolean, type: 'column', callback: InteratorColumn, returns?: boolean): Api<any>;
952
+ iterator(flatten: boolean, type: 'columns', callback: InteratorColumns, returns?: boolean): Api<any>;
953
+ iterator(flatten: boolean, type: 'row', callback: InteratorRow, returns?: boolean): Api<any>;
954
+ iterator(flatten: boolean, type: 'rows', callback: InteratorRows, returns?: boolean): Api<any>;
779
955
 
780
956
  /**
781
957
  * Join the elements in the result set into a string.
@@ -829,7 +1005,7 @@ export interface Api<T> {
829
1005
  * Table events listener.
830
1006
  *
831
1007
  * @param event Event to listen for.
832
- * @param callback Specific callback function to remove if you want to unbind a single event listener.
1008
+ * @param callback Event handler.
833
1009
  * @returns DataTables Api instance
834
1010
  */
835
1011
  on(event: string, callback: ((this: HTMLElement, e: Event, ...args: any[]) => void)): Api<T>;
@@ -848,7 +1024,7 @@ export interface Api<T> {
848
1024
  * Listen for a table event once and then remove the listener.
849
1025
  *
850
1026
  * @param event Event to listen for.
851
- * @param callback Specific callback function to remove if you want to unbind a single event listener.
1027
+ * @param callback Event handler.
852
1028
  * Listen for events from tables and fire a callback when they occur
853
1029
  * @returns DataTables Api instance
854
1030
  */
@@ -864,6 +1040,11 @@ export interface Api<T> {
864
1040
  */
865
1041
  one(event: string, selector: string, callback: ((this: HTMLElement, e: Event, ...args: any[]) => void)): Api<T>;
866
1042
 
1043
+ /**
1044
+ * Order Methods / object
1045
+ */
1046
+ order: ApiOrder;
1047
+
867
1048
  /**
868
1049
  * Page Methods / object
869
1050
  */
@@ -893,9 +1074,16 @@ export interface Api<T> {
893
1074
  push(value_1: any, ...value_2: any[]): number;
894
1075
 
895
1076
  /**
896
- * Order Methods / object
1077
+ * Determine if the DataTable is ready or not
897
1078
  */
898
- order: ApiOrder;
1079
+ ready(): boolean;
1080
+
1081
+ /**
1082
+ * Execute a function when the DataTable becomes ready (or immediately if it already is)
1083
+ *
1084
+ * @param fn Function to execute
1085
+ */
1086
+ ready(fn: ((this: Api<T>) => void)): Api<T>;
899
1087
 
900
1088
  /**
901
1089
  * Apply a callback function against and accumulator and each element in the Api's result set (left-to-right).
@@ -933,22 +1121,9 @@ export interface Api<T> {
933
1121
  rows: ApiRows<T>;
934
1122
 
935
1123
  /**
936
- * Get current search
937
- *
938
- * @returns The currently applied global search. This may be an empty string if no search is applied.
939
- */
940
- search(): string;
941
-
942
- /**
943
- * Set the global search to use on the table. Note this doesn't actually perform the search.
944
- *
945
- * @param input Search string to apply to the table.
946
- * @param regex Treat as a regular expression (true) or not (default, false).
947
- * @param smart Perform smart search.
948
- * @param caseInsen Do case-insensitive matching (default, true) or not (false).
949
- * @returns DataTables API instance
1124
+ * Search Methods / object
950
1125
  */
951
- search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
1126
+ search: ApiSearch<T>;
952
1127
 
953
1128
  /**
954
1129
  * Obtain the table's settings object
@@ -1032,7 +1207,19 @@ export interface Api<T> {
1032
1207
  toJQuery(): JQuery;
1033
1208
 
1034
1209
  /**
1035
- * Create a new API instance containing only the unique items from a the elements in an instance's result set.
1210
+ * Trigger a DataTables related event.
1211
+ *
1212
+ * @param name The event name.
1213
+ * @param args An array of the arguments to send to the event.
1214
+ * @param bubbles Indicate if the event should bubble up the document in the
1215
+ * same way that DOM events usually do, or not. There is a performance
1216
+ * impact for bubbling events.
1217
+ * @returns Api instance for chaining
1218
+ */
1219
+ trigger( name: string, args: any[], bubbles?: boolean): Api<T>;
1220
+
1221
+ /**
1222
+ * Create a new API instance containing only the unique items from the elements in an instance's result set.
1036
1223
  *
1037
1224
  * @returns New Api instance which contains the unique items from the original instance's result set, in its own result set.
1038
1225
  */
@@ -1050,10 +1237,11 @@ export interface Api<T> {
1050
1237
 
1051
1238
  export interface ApiSelectorModifier {
1052
1239
  /**
1053
- * The order modifier provides the ability to control which order the rows are processed in.
1054
- * Values: 'current', 'applied', 'index', 'original'
1240
+ * The order modifier provides the ability to control which order the rows are
1241
+ * processed in. Can be one of 'current', 'applied', 'index', 'original', or
1242
+ * the column index that you want the order to be applied from.
1055
1243
  */
1056
- order?: string;
1244
+ order?: string | number;
1057
1245
 
1058
1246
  /**
1059
1247
  * 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.
@@ -1084,7 +1272,59 @@ export interface AjaxMethods extends Api<any> {
1084
1272
  load(callback?: ((json: any) => void), resetPaging?: boolean): Api<any>;
1085
1273
  }
1086
1274
 
1275
+ export interface ApiSearch<T> {
1276
+ /**
1277
+ * Get current search
1278
+ *
1279
+ * @returns The currently applied global search. This may be an empty string if no search is applied.
1280
+ */
1281
+ (): SearchInput<T>;
1282
+
1283
+ /**
1284
+ * Set the global search to use on the table. Note this doesn't actually perform the search.
1285
+ *
1286
+ * @param input Search string to apply to the table.
1287
+ * @param regex Treat as a regular expression (true) or not (default, false).
1288
+ * @param smart Perform smart search.
1289
+ * @param caseInsen Do case-insensitive matching (default, true) or not (false).
1290
+ * @returns DataTables API instance
1291
+ */
1292
+ (input: SearchInput<T>, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
1293
+
1294
+ /**
1295
+ * Set the global search to use on the table. Note this doesn't actually perform the search.
1296
+ *
1297
+ * @param input Search string to apply to the table.
1298
+ * @param options Configuration options for how the search should be performed
1299
+ * @returns DataTables API instance
1300
+ */
1301
+ (input: SearchInput<T>, options: SearchOptions): Api<any>;
1087
1302
 
1303
+ /**
1304
+ * Get a list of the names of searches applied to the table.
1305
+ *
1306
+ * @returns API instance containing the fixed search terms
1307
+ */
1308
+ fixed(): Api<string>;
1309
+
1310
+ /**
1311
+ * Get the search term used for the given name.
1312
+ *
1313
+ * @param name Fixed search term to get.
1314
+ * @returns The search term for the name given or undefined if not set.
1315
+ */
1316
+ fixed( name: string ): SearchInput<T> | undefined;
1317
+
1318
+ /**
1319
+ * Set a search term to apply to the table, using a name to uniquely identify it.
1320
+ *
1321
+ * @param name Name to give the fixed search term
1322
+ * @param search The search term to apply to the table or `null` to delete
1323
+ * an existing search term by the given name.
1324
+ * @returns API for chaining
1325
+ */
1326
+ fixed( name: string, search: SearchInput<T> | null ): Api<T>;
1327
+ }
1088
1328
 
1089
1329
 
1090
1330
  export interface ApiPageInfo {
@@ -1263,7 +1503,7 @@ export interface ApiOrder {
1263
1503
  *
1264
1504
  * @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
1265
1505
  */
1266
- (): Array<Array<(string | number)>>;
1506
+ (): OrderArray[];
1267
1507
 
1268
1508
  /**
1269
1509
  * Set the ordering applied to the table.
@@ -1271,8 +1511,8 @@ export interface ApiOrder {
1271
1511
  * @param order Order Model
1272
1512
  * @returns DataTables Api instance
1273
1513
  */
1274
- (order?: Array<(string | number)> | Array<Array<(string | number)>>): Api<any>;
1275
- (order: Array<(string | number)>, ...args: any[]): Api<any>;
1514
+ (order?: Order | Order[]): Api<any>;
1515
+ (order: Order, ...args: Order[]): Api<any>;
1276
1516
 
1277
1517
  /**
1278
1518
  * Get the fixed ordering that is applied to the table. If there is more than one table in the API's context,
@@ -1337,7 +1577,7 @@ export interface ApiCell<T> {
1337
1577
  * Select the cell found by a cell selector
1338
1578
  *
1339
1579
  * @param cellSelector Cell selector.
1340
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
1580
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering
1341
1581
  * @returns DataTables API instance with selected cell
1342
1582
  */
1343
1583
  (cellSelector: CellSelector, modifier?: ApiSelectorModifier): ApiCellMethods<T>;
@@ -1347,10 +1587,10 @@ export interface ApiCell<T> {
1347
1587
  *
1348
1588
  * @param rowSelector Row selector.
1349
1589
  * @param columnSelector Column selector.
1350
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
1590
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering
1351
1591
  * @returns DataTables API instance with selected cell
1352
1592
  */
1353
- (rowSelector: CellSelector, columnSelector: any, modifier?: ApiSelectorModifier): ApiCellMethods<T>;
1593
+ (rowSelector: RowSelector<T>, columnSelector: ColumnSelector, modifier?: ApiSelectorModifier): ApiCellMethods<T>;
1354
1594
  }
1355
1595
 
1356
1596
  export interface ApiCellMethods<T> extends Omit<Api<T>, 'render'> {
@@ -1412,7 +1652,7 @@ export interface ApiCells<T> {
1412
1652
  /**
1413
1653
  * Select all cells
1414
1654
  *
1415
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
1655
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering
1416
1656
  * @returns DataTables API instance with selected cells
1417
1657
  */
1418
1658
  (modifier?: ApiSelectorModifier): ApiCellsMethods<T>;
@@ -1421,7 +1661,7 @@ export interface ApiCells<T> {
1421
1661
  * Select cells found by a cell selector
1422
1662
  *
1423
1663
  * @param cellSelector Cell selector.
1424
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
1664
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering
1425
1665
  * @returns DataTables API instance with selected cells
1426
1666
  */
1427
1667
  (cellSelector: CellSelector, modifier?: ApiSelectorModifier): ApiCellsMethods<T>;
@@ -1431,10 +1671,10 @@ export interface ApiCells<T> {
1431
1671
  *
1432
1672
  * @param rowSelector Row selector.
1433
1673
  * @param columnSelector Column selector.
1434
- * @param Option used to specify how the cells should be ordered, and if paging or filtering
1674
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering
1435
1675
  * @returns DataTables API instance with selected cells
1436
1676
  */
1437
- (rowSelector: RowSelector<T>, columnSelector: CellSelector, modifier?: ApiSelectorModifier): ApiCellsMethods<T>;
1677
+ (rowSelector: RowSelector<T>, columnSelector: ColumnSelector, modifier?: ApiSelectorModifier): ApiCellsMethods<T>;
1438
1678
  }
1439
1679
 
1440
1680
  export interface ApiCellsMethods<T> extends Omit<Api<T>, 'data' | 'render'> {
@@ -1485,19 +1725,53 @@ export interface ApiCellsMethods<T> extends Omit<Api<T>, 'data' | 'render'> {
1485
1725
  * @returns Rendered data for the requested type
1486
1726
  */
1487
1727
  render(type: string): any;
1728
+
1729
+ /**
1730
+ * Get the title text for a column
1731
+ *
1732
+ * @param row Indicate which row in the header the title should be read from
1733
+ * when working with multi-row headers.
1734
+ * @return Column title
1735
+ */
1736
+ title( row?: number ): string;
1737
+
1738
+ /**
1739
+ * Set the title text for a column
1740
+ *
1741
+ * @param title Title to set
1742
+ * @param row Indicate which row in the header the title should be read from
1743
+ * when working with multi-row headers.
1744
+ * @return DataTables API instance for chaining
1745
+ */
1746
+ title( title: string, row?: number ): Api<T>;
1747
+
1748
+ /**
1749
+ * Get the column's data type (auto detected or configured).
1750
+ *
1751
+ * @return The column's data type.
1752
+ */
1753
+ type(): string;
1754
+
1755
+ /**
1756
+ * Compute the width of a column as it is shown.
1757
+ *
1758
+ * @return The width of the column in pixels or `null` if there is no data
1759
+ * in the table.
1760
+ */
1761
+ width(): number | null;
1488
1762
  }
1489
1763
 
1490
1764
 
1491
1765
 
1492
1766
 
1493
- export interface ApiColumn {
1767
+ export interface ApiColumn<T> {
1494
1768
  /**
1495
1769
  * Select the column found by a column selector
1496
1770
  *
1497
- * @param cellSelector Cell selector.
1498
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1771
+ * @param columnSelector Column selector.
1772
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1499
1773
  */
1500
- (columnSelector: ColumnSelector, modifier?: ApiSelectorModifier): ApiColumnMethods;
1774
+ (columnSelector: ColumnSelector, modifier?: ApiSelectorModifier): ApiColumnMethods<T>;
1501
1775
 
1502
1776
  /**
1503
1777
  * Convert from the input column index type to that required.
@@ -1509,7 +1783,7 @@ export interface ApiColumn {
1509
1783
  index(type: string, index: number): number;
1510
1784
  }
1511
1785
 
1512
- export interface ApiColumnMethods {
1786
+ export interface ApiColumnMethods<T> extends Omit<Api<T>, 'init' | 'data' | 'order' | 'render' | 'search'> {
1513
1787
  /**
1514
1788
  * Get the DataTables cached data for the selected column(s)
1515
1789
  *
@@ -1533,18 +1807,22 @@ export interface ApiColumnMethods {
1533
1807
  dataSrc(): number | string | (() => string);
1534
1808
 
1535
1809
  /**
1536
- * Get the footer th / td cell for the selected column(s).
1810
+ * Get the footer th / td cell for the selected column.
1537
1811
  *
1538
- * @returns HTML element for the footer of the column(s)
1812
+ * @param row Indicate which row in the footer the cell should be read from
1813
+ * when working with multi-row footers.
1814
+ * @returns HTML element for the footer of the column
1539
1815
  */
1540
- footer(): HTMLElement;
1816
+ footer(row?: number): HTMLElement;
1541
1817
 
1542
1818
  /**
1543
- * Get the header th / td cell for a column(s).
1819
+ * Get the header th / td cell for a column.
1544
1820
  *
1545
- * @returns HTML element for the header of the column(s)
1821
+ * @param row Indicate which row in the header the cell should be read from
1822
+ * when working with multi-row headers.
1823
+ * @returns HTML element for the header of the column
1546
1824
  */
1547
- header(): HTMLElement;
1825
+ header(row?: number): HTMLElement;
1548
1826
 
1549
1827
  /**
1550
1828
  * Get the column index of the selected column.
@@ -1554,6 +1832,13 @@ export interface ApiColumnMethods {
1554
1832
  */
1555
1833
  index(type?: string): number;
1556
1834
 
1835
+ /**
1836
+ * Get the initialisation object used for the selected column.
1837
+ *
1838
+ * @returns Column configuration object
1839
+ */
1840
+ init(): ConfigColumns;
1841
+
1557
1842
  /**
1558
1843
  * Obtain the th / td nodes for the selected column
1559
1844
  *
@@ -1570,22 +1855,52 @@ export interface ApiColumnMethods {
1570
1855
  order(direction: string): Api<any>;
1571
1856
 
1572
1857
  /**
1573
- * Get the currently applied column search.
1574
- *
1575
- * @returns the currently applied column search.
1858
+ * Get the orderable state for the column (from `columns.orderable`).
1576
1859
  */
1577
- search(): string;
1860
+ orderable(): boolean;
1578
1861
 
1579
1862
  /**
1580
- * Set the search term for the matched columns.
1863
+ * Get a list of the column ordering directions (from `columns.orderSequence`).
1864
+ */
1865
+ orderable(directions: true): Api<string>;
1866
+
1867
+ /**
1868
+ * Get rendered data for the selected column.
1869
+ * @param type Data type to get. Typically `display`, `filter`, `sort` or `type`
1870
+ * although can be anything that the rendering functions expect.
1871
+ */
1872
+ render(type?: string): Api<T>;
1873
+
1874
+ /**
1875
+ * Search methods and properties
1876
+ */
1877
+ search: ApiColumnSearch<T>;
1878
+
1879
+ /**
1880
+ * Get the title text for the selected column
1581
1881
  *
1582
- * @param input Search string to apply.
1583
- * @param regex Treat as a regular expression (true) or not (default, false).
1584
- * @param smart Perform smart search.
1585
- * @param caseInsen Do case-insensitive matching (default, true) or not (false).
1586
- * @returns DataTables API instance
1882
+ * @param row Indicate which row in the header the title should be read from
1883
+ * when working with multi-row headers.
1884
+ * @return Column titles in API instance's data set
1885
+ */
1886
+ title( row?: number ): string;
1887
+
1888
+ /**
1889
+ * Set the title text for the selected column
1890
+ *
1891
+ * @param title Title to set
1892
+ * @param row Indicate which row in the header the title should be read from
1893
+ * when working with multi-row headers.
1894
+ * @return DataTables API instance for chaining
1587
1895
  */
1588
- search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
1896
+ title( title: string, row?: number ): Api<T>;
1897
+
1898
+ /**
1899
+ * Get the data type for the selected column (auto detected or configured).
1900
+ *
1901
+ * @return DataTables API instance with column types in its data set
1902
+ */
1903
+ type(): string;
1589
1904
 
1590
1905
  /**
1591
1906
  * Get the visibility of the selected column.
@@ -1602,25 +1917,87 @@ export interface ApiColumnMethods {
1602
1917
  * @returns DataTables API instance with selected column in the result set.
1603
1918
  */
1604
1919
  visible(show: boolean, redrawCalculations?: boolean): Api<any>;
1920
+
1921
+ /**
1922
+ * Compute the width of the selected column as they are shown.
1923
+ *
1924
+ * @return Api instance with the width of each column in pixels or `null` if
1925
+ * there is no data in the table.
1926
+ */
1927
+ width(): number | null;
1928
+ }
1929
+
1930
+ export interface ApiColumnSearch<T> {
1931
+ /**
1932
+ * Get the currently applied column search.
1933
+ *
1934
+ * @returns the currently applied column search.
1935
+ */
1936
+ (): string;
1937
+
1938
+ /**
1939
+ * Set the search term for the matched column.
1940
+ *
1941
+ * @param input Search apply.
1942
+ * @param regex Treat as a regular expression (true) or not (default, false).
1943
+ * @param smart Perform smart search.
1944
+ * @param caseInsen Do case-insensitive matching (default, true) or not (false).
1945
+ * @returns DataTables API instance
1946
+ */
1947
+ (input: SearchInputColumn<T>, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
1948
+
1949
+ /**
1950
+ * Set the search term for the matched column.
1951
+ *
1952
+ * @param input Search to apply.
1953
+ * @param Search Search configuration options
1954
+ * @returns DataTables API instance
1955
+ */
1956
+ (input: SearchInputColumn<T>, options: SearchOptions): Api<any>;
1957
+
1958
+ /**
1959
+ * Get a list of the names of searches applied to the column
1960
+ *
1961
+ * @returns API instance containing the column's fixed search terms
1962
+ */
1963
+ fixed(): Api<string>;
1964
+
1965
+ /**
1966
+ * Get the search term for the column used for the given name.
1967
+ *
1968
+ * @param name Fixed search term to get.
1969
+ * @returns The search term for the name given or undefined if not set.
1970
+ */
1971
+ fixed( name: string ): SearchInputColumn<T> | undefined;
1972
+
1973
+ /**
1974
+ * Set a search term to apply to the column, using a name to uniquely identify it.
1975
+ *
1976
+ * @param name Name to give the fixed search term
1977
+ * @param search The search term to apply to the column or `null` to delete
1978
+ * an existing search term by the given name.
1979
+ * @returns API for chaining
1980
+ */
1981
+ fixed( name: string, search: SearchInputColumn<T> | null ): Api<T>;
1605
1982
  }
1606
1983
 
1607
1984
  export interface ApiColumns<T> {
1608
1985
  /**
1609
1986
  * Select all columns
1610
1987
  *
1611
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1988
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1612
1989
  * @returns DataTables API instance with selected columns in the result set.
1613
1990
  */
1614
- (modifier?: ApiSelectorModifier): ApiColumnsMethods | Api<Array<any>>;
1991
+ (modifier?: ApiSelectorModifier): ApiColumnsMethods<T>;
1615
1992
 
1616
1993
  /**
1617
1994
  * Select columns found by a cell selector
1618
1995
  *
1619
- * @param cellSelector Cell selector.
1620
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1996
+ * @param columnSelector Column selector.
1997
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1621
1998
  * @returns DataTables API instance with selected columns
1622
1999
  */
1623
- (columnSelector: ColumnSelector, modifier?: ApiSelectorModifier): ApiColumnsMethods;
2000
+ (columnSelector: ColumnSelector, modifier?: ApiSelectorModifier): ApiColumnsMethods<T>;
1624
2001
 
1625
2002
  /**
1626
2003
  * Recalculate the column widths for layout.
@@ -1631,7 +2008,7 @@ export interface ApiColumns<T> {
1631
2008
  }
1632
2009
 
1633
2010
 
1634
- export interface ApiColumnsMethods {
2011
+ export interface ApiColumnsMethods<T> extends Omit<Api<T>, 'init' | 'data' | 'order' | 'render' | 'search'> {
1635
2012
  /**
1636
2013
  * Get the DataTables cached data for the selected columna
1637
2014
  *
@@ -1660,14 +2037,25 @@ export interface ApiColumnsMethods {
1660
2037
  * @param fn Function to execute for every column selected.
1661
2038
  * @returns DataTables API instance of the selected columns.
1662
2039
  */
1663
- every(fn: (this: ApiColumnMethods, colIdx: number, tableLoop: number, colLoop: number) => void): Api<any>;
2040
+ every(fn: (this: ApiColumnMethods<T>, colIdx: number, tableLoop: number, colLoop: number) => void): Api<any>;
1664
2041
 
1665
2042
  /**
1666
- * Get the footer th / td cell for the selected columna.
2043
+ * Get the footer th / td cell for the selected columns.
1667
2044
  *
1668
- * @returns HTML element for the footer of the columna
2045
+ * @param row Indicate which row in the footer the cell should be read from
2046
+ * when working with multi-row footers.
2047
+ * @returns HTML element for the footer of the columns
1669
2048
  */
1670
- footer(): HTMLElement;
2049
+ footer(row?: number): Api<HTMLElement>;
2050
+
2051
+ /**
2052
+ * Get the header th / td cell for a columns.
2053
+ *
2054
+ * @param row Indicate which row in the header the cell should be read from
2055
+ * when working with multi-row headers.
2056
+ * @returns HTML element for the header of the columns
2057
+ */
2058
+ header(row?: number): Api<HTMLElement>;
1671
2059
 
1672
2060
  /**
1673
2061
  * Get the column indexes of the selected columns.
@@ -1678,11 +2066,11 @@ export interface ApiColumnsMethods {
1678
2066
  indexes(type?: string): Api<Array<number>>;
1679
2067
 
1680
2068
  /**
1681
- * Get the header th / td cell for a columna.
1682
- *
1683
- * @returns HTML element for the header of the columna
2069
+ * Get the initialisation objects used for the selected columns.
2070
+ *
2071
+ * @returns Api instance of column configuration objects
1684
2072
  */
1685
- header(): HTMLElement;
2073
+ init(): Api<ConfigColumns>;
1686
2074
 
1687
2075
  /**
1688
2076
  * Obtain the th / td nodes for the selected columns
@@ -1700,22 +2088,52 @@ export interface ApiColumnsMethods {
1700
2088
  order(direction: string): Api<any>;
1701
2089
 
1702
2090
  /**
1703
- * Get the currently applied columns search.
1704
- *
1705
- * @returns the currently applied columns search.
2091
+ * Get the orderable state for the selected columns (from `columns.orderable`).
1706
2092
  */
1707
- search(): Api<Array<string>>;
2093
+ orderable(): Api<boolean>;
1708
2094
 
1709
2095
  /**
1710
- * Set the search term for the columns from the selector. Note this doesn't actually perform the search.
2096
+ * Get a list of the column ordering directions (from `columns.orderSequence`).
2097
+ */
2098
+ orderable(directions: true): Api<Array<string>>;
2099
+
2100
+ /**
2101
+ * Get rendered data for the selected columns.
2102
+ * @param type Data type to get. Typically `display`, `filter`, `sort` or `type`
2103
+ * although can be anything that the rendering functions expect.
2104
+ */
2105
+ render(type?: string): Api<Array<T>>;
2106
+
2107
+ /**
2108
+ * Search methods and properties
2109
+ */
2110
+ search: ApiColumnsSearch<T>;
2111
+
2112
+ /**
2113
+ * Get the title text for the selected columns
2114
+ *
2115
+ * @param row Indicate which row in the header the title should be read from
2116
+ * when working with multi-row headers.
2117
+ * @return Column titles in API instance's data set
2118
+ */
2119
+ titles( row?: number ): Api<string>;
2120
+
2121
+ /**
2122
+ * Set the title text for the selected columns
2123
+ *
2124
+ * @param title Title to set
2125
+ * @param row Indicate which row in the header the title should be read from
2126
+ * when working with multi-row headers.
2127
+ * @return DataTables API instance for chaining
2128
+ */
2129
+ titles( title: string, row?: number ): Api<T>;
2130
+
2131
+ /**
2132
+ * Get the data type for the selected columns (auto detected or configured).
1711
2133
  *
1712
- * @param input Search string to apply to the selected columns.
1713
- * @param regex Treat as a regular expression (true) or not (default, false).
1714
- * @param smart Perform smart search (default, true) or not (false).
1715
- * @param caseInsen Do case-insensitive matching (default, true) or not (false).
1716
- * @returns DataTables Api instance.
2134
+ * @return DataTables API instance with column types in its data set
1717
2135
  */
1718
- search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
2136
+ types(): Api<string>;
1719
2137
 
1720
2138
  /**
1721
2139
  * Get the visibility of the selected columns.
@@ -1732,6 +2150,69 @@ export interface ApiColumnsMethods {
1732
2150
  * @returns DataTables API instance with selected columns in the result set.
1733
2151
  */
1734
2152
  visible(show: boolean, redrawCalculations?: boolean): Api<any>;
2153
+
2154
+ /**
2155
+ * Compute the width of the selected columns as they are shown.
2156
+ *
2157
+ * @return Api instance with the width of each column in pixels or `null` if
2158
+ * there is no data in the table.
2159
+ */
2160
+ widths(): Api<number | null>;
2161
+ }
2162
+
2163
+ export interface ApiColumnsSearch<T> {
2164
+ /**
2165
+ * Get the currently applied columns search.
2166
+ *
2167
+ * @returns the currently applied columns search.
2168
+ */
2169
+ (): Api<SearchInputColumn<T>[]>;
2170
+
2171
+ /**
2172
+ * Set the search term for the columns from the selector. Note this doesn't actually perform the search.
2173
+ *
2174
+ * @param input Search to apply to the selected columns.
2175
+ * @param regex Treat as a regular expression (true) or not (default, false).
2176
+ * @param smart Perform smart search (default, true) or not (false).
2177
+ * @param caseInsen Do case-insensitive matching (default, true) or not (false).
2178
+ * @returns DataTables Api instance.
2179
+ */
2180
+ (input: SearchInputColumn<T>, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api<any>;
2181
+
2182
+ /**
2183
+ * Set the search term for the matched columns.
2184
+ *
2185
+ * @param input Search to apply.
2186
+ * @param Search Search configuration options
2187
+ * @returns DataTables API instance
2188
+ */
2189
+ (input: SearchInputColumn<T>, options: SearchOptions): Api<any>;
2190
+
2191
+ /**
2192
+ * Get a list of the names of searches applied to the matched columns
2193
+ *
2194
+ * @returns API instance containing the column's fixed search terms
2195
+ */
2196
+ fixed(): Api<string[]>;
2197
+
2198
+ /**
2199
+ * Get the search term for the matched columns used for the given name.
2200
+ *
2201
+ * @param name Fixed search term to get.
2202
+ * @returns The search term for the name given or undefined if not set.
2203
+ */
2204
+ fixed( name: string ): Api<SearchInputColumn<T> | undefined>;
2205
+
2206
+ /**
2207
+ * Set a search term to apply to the matched columns, using a name to
2208
+ * uniquely identify it.
2209
+ *
2210
+ * @param name Name to give the fixed search term
2211
+ * @param search The search term to apply to the column or `null` to delete
2212
+ * an existing search term by the given name.
2213
+ * @returns API for chaining
2214
+ */
2215
+ fixed( name: string, search: SearchInputColumn<T> | null ): Api<T>;
1735
2216
  }
1736
2217
 
1737
2218
 
@@ -1817,7 +2298,7 @@ export interface ApiRow<T> {
1817
2298
  * Select a row found by a row selector
1818
2299
  *
1819
2300
  * @param rowSelector Row selector.
1820
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
2301
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1821
2302
  * @returns DataTables API instance with selected row in the result set
1822
2303
  */
1823
2304
  (rowSelector: RowSelector<T>, modifier?: ApiSelectorModifier): ApiRowMethods<T>;
@@ -1902,7 +2383,7 @@ export interface ApiRows<T> {
1902
2383
  /**
1903
2384
  * Select all rows
1904
2385
  *
1905
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
2386
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1906
2387
  * @returns DataTables API instance with selected rows
1907
2388
  */
1908
2389
  (modifier?: ApiSelectorModifier): ApiRowsMethods<T>;
@@ -1910,8 +2391,8 @@ export interface ApiRows<T> {
1910
2391
  /**
1911
2392
  * Select rows found by a row selector
1912
2393
  *
1913
- * @param cellSelector Row selector.
1914
- * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
2394
+ * @param rowSelector Row selector.
2395
+ * @param modifier Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
1915
2396
  * @returns DataTables API instance with selected rows in the result set
1916
2397
  */
1917
2398
  (rowSelector: RowSelector<T>, modifier?: ApiSelectorModifier): ApiRowsMethods<T>;
@@ -1989,19 +2470,37 @@ export interface ApiRowsMethods<T> extends Api<T> {
1989
2470
 
1990
2471
 
1991
2472
  export interface ApiTableMethods<T> extends Api<T> {
1992
- /**
1993
- * Get the tfoot node for the table in the API's context
1994
- *
1995
- * @returns HTML tbody node.
1996
- */
1997
- footer(): Node;
2473
+ footer: {
2474
+ /**
2475
+ * Get the tfoot node for the table in the API's context
2476
+ *
2477
+ * @returns HTML tbody node.
2478
+ */
2479
+ (): Node;
1998
2480
 
1999
- /**
2000
- * Get the thead node for the table in the API's context
2001
- *
2002
- * @returns HTML thead node.
2003
- */
2004
- header(): Node;
2481
+ /**
2482
+ * Get an array that represents the structure of the footer
2483
+ *
2484
+ * @param selector Column selector
2485
+ */
2486
+ structure(selector?: string): HeaderStructure[][];
2487
+ }
2488
+
2489
+ header: {
2490
+ /**
2491
+ * Get the thead node for the table in the API's context
2492
+ *
2493
+ * @returns HTML thead node.
2494
+ */
2495
+ (): Node;
2496
+
2497
+ /**
2498
+ * Get an array that represents the structure of the header
2499
+ *
2500
+ * @param selector Column selector
2501
+ */
2502
+ structure(selector?: string): HeaderStructure[][];
2503
+ }
2005
2504
 
2006
2505
  /**
2007
2506
  * Get the tbody node for the table in the API's context
@@ -2054,6 +2553,14 @@ export interface ApiTablesMethods<T> extends Api<T> {
2054
2553
  */
2055
2554
  containers(): Api<Array<Node>>;
2056
2555
 
2556
+ /**
2557
+ * Iterate over each selected table, with the function context set to be the table in question. Since: DataTables 1.10.6
2558
+ *
2559
+ * @param fn Function to execute for every table selected.
2560
+ */
2561
+ every(fn: (this: ApiTableMethods<T>, tableIndex: number) => void): Api<any>;
2562
+
2563
+
2057
2564
  /**
2058
2565
  * Get the table nodes for the tables in the API's context
2059
2566
  *
@@ -2063,28 +2570,38 @@ export interface ApiTablesMethods<T> extends Api<T> {
2063
2570
  }
2064
2571
 
2065
2572
 
2573
+ export interface DataTablesStatic {
2574
+ /**
2575
+ * Get DataTable API instance
2576
+ *
2577
+ * @param table Selector string for table
2578
+ */
2579
+ Api: ApiStatic;
2066
2580
 
2581
+ /**
2582
+ * Default Settings
2583
+ */
2584
+ defaults: Config;
2067
2585
 
2586
+ /**
2587
+ * Default Settings
2588
+ */
2589
+ ext: DataTablesStaticExt;
2068
2590
 
2591
+ /** Feature control namespace */
2592
+ feature: {
2593
+ /**
2594
+ * Create a new feature that can be used for layout
2595
+ *
2596
+ * @param name The name of the new feature.
2597
+ * @param construct A function that will create the elements and event listeners for the feature being added.
2598
+ */
2599
+ register(name: string, construct: (dt: InternalSettings, options: any) => HTMLElement | JQuery): void;
2600
+ }
2069
2601
 
2070
-
2071
-
2072
-
2073
-
2074
-
2075
-
2076
-
2077
-
2078
-
2079
-
2080
-
2081
-
2082
- export interface DataTablesStatic {
2083
2602
  /**
2084
2603
  * Check if a table node is a DataTable already or not.
2085
2604
  *
2086
- * Usage:
2087
- * $.fn.dataTable.isDataTable("selector");
2088
2605
  * @param table The table to check.
2089
2606
  * @returns true the given table is a DataTable, false otherwise
2090
2607
  */
@@ -2118,38 +2635,52 @@ export interface DataTablesStatic {
2118
2635
  } | boolean): Array<Api<any>>| Api<any>;
2119
2636
 
2120
2637
  /**
2121
- * Version number compatibility check function
2638
+ * Get the data type definition object for a specific registered data type.
2122
2639
  *
2123
- * Usage:
2124
- * $.fn.dataTable.versionCheck("1.10.0");
2125
- * @param version Version string
2126
- * @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
2640
+ * @param name Data type name to get the definition of
2127
2641
  */
2128
- versionCheck(version: string): boolean;
2642
+ type(name: string): DataType;
2129
2643
 
2130
2644
  /**
2131
- * Utils
2645
+ * Set one or more properties for a specific data type.
2646
+ *
2647
+ * @param name Data type name to set values for
2648
+ * @param definition Object containing the values to set
2132
2649
  */
2133
- util: DataTablesStaticUtil;
2650
+ type(name: string, definition: DataType): void;
2134
2651
 
2135
2652
  /**
2136
- * Get DataTable API instance
2653
+ * Set an individual property value for a a given data type.
2137
2654
  *
2138
- * @param table Selector string for table
2655
+ * @param name Data type name to set a property value for
2656
+ * @param property Name of the data type property to set
2657
+ * @param val The value to set (typically a function or string)
2139
2658
  */
2140
- Api: ApiStatic;
2659
+ type(name: string, property: keyof(DataType), val: any): void;
2141
2660
 
2142
2661
  /**
2143
- * Default Settings
2662
+ * Get the names of the registered data types DataTables can work with.
2144
2663
  */
2145
- defaults: Config;
2664
+ types(): string[];
2146
2665
 
2147
2666
  /**
2148
- * Default Settings
2667
+ * Utils
2149
2668
  */
2150
- ext: DataTablesStaticExt;
2669
+ util: DataTablesStaticUtil;
2670
+
2671
+ /**
2672
+ * Version number compatibility check function
2673
+ *
2674
+ * Usage:
2675
+ * $.fn.dataTable.versionCheck("1.10.0");
2676
+ * @param version Version string
2677
+ * @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
2678
+ */
2679
+ versionCheck(version: string): boolean;
2151
2680
  }
2152
2681
 
2682
+ export type ApiStaticRegisterFn<T> = (this: Api<T>, ...args: any[]) => any;
2683
+
2153
2684
  export interface ApiStatic {
2154
2685
  /**
2155
2686
  * Create a new API instance to an existing DataTable. Note that this
@@ -2157,8 +2688,8 @@ export interface ApiStatic {
2157
2688
  */
2158
2689
  new (selector: string | Node | Node[] | JQuery | InternalSettings): Api<any>;
2159
2690
 
2160
- register<T=any>(name: string, fn: Function): T;
2161
- registerPlural<T=any>(pluralName: string, singleName: string, fn: Function): T;
2691
+ register<T=any>(name: string, fn: ApiStaticRegisterFn<T>): void;
2692
+ registerPlural<T=any>(pluralName: string, singleName: string, fn: ApiStaticRegisterFn<T>): void;
2162
2693
  }
2163
2694
 
2164
2695
  export interface OrderFixed {
@@ -2267,6 +2798,23 @@ export interface DataTablesStaticRender {
2267
2798
  }
2268
2799
 
2269
2800
  export interface DataTablesStaticUtil {
2801
+ /**
2802
+ * Normalise diacritic characters in a string.
2803
+ *
2804
+ * @param str String to have diacritic characters replaced
2805
+ * @param appendOriginal Append the original string to the result
2806
+ * (`true`) or not (`false`)
2807
+ * @returns Updated string
2808
+ */
2809
+ diacritics(str: string, appendOriginal?: boolean): string;
2810
+
2811
+ /**
2812
+ * Set the diacritic removal function
2813
+ *
2814
+ * @param replacement Removal function
2815
+ */
2816
+ diacritics(replacement: (str: string, appendOriginal: boolean) => string): void;
2817
+
2270
2818
  /**
2271
2819
  * Escape special characters in a regular expression string. Since: 1.10.4
2272
2820
  *
@@ -2275,17 +2823,47 @@ export interface DataTablesStaticUtil {
2275
2823
  */
2276
2824
  escapeRegex(str: string): string;
2277
2825
 
2826
+ /**
2827
+ * Escape entities in a string.
2828
+ *
2829
+ * @param str String to have HTML entities escaped
2830
+ * @returns Sanitized string
2831
+ */
2832
+ escapeHtml(str: string): string;
2833
+
2834
+ /**
2835
+ * Set the HTML escaping function.
2836
+ *
2837
+ * @param escapeFunction Function to use for HTML escaping in DataTables.
2838
+ */
2839
+ escapeHtml(escapeFunction: (str: string) => string): void;
2840
+
2278
2841
  /**
2279
2842
  * Create a read function from a descriptor. Since 1.11
2280
2843
  * @param source A descriptor that is used to define how to read the data from the source object.
2281
2844
  */
2282
- get<T=any, D=any>(source: string | object | Function | null): ((data: D, type: string, val: T, meta: CellMetaSettings) => T);
2845
+ get<T=any, D=any>(source: string | number | object | Function | null): ((data: D, type?: string, val?: T, meta?: CellMetaSettings) => T);
2283
2846
 
2284
2847
  /**
2285
2848
  * Create a write function from a descriptor. Since 1.11
2286
2849
  * @param source A descriptor that is used to define how to write data to a source object
2287
2850
  */
2288
- set<T=any, D=any>(source: string | object | Function | null): ((data: D, val: T, meta: CellMetaSettings) => void);
2851
+ set<T=any, D=any>(source: string | number | object | Function | null): ((data: D, val: T, meta?: CellMetaSettings) => void);
2852
+
2853
+ /**
2854
+ * Remove mark up from a string
2855
+ *
2856
+ * @param str String to have HTML tags stripped from.
2857
+ * @returns Stripped string
2858
+ */
2859
+ stripHtml(str: string): string;
2860
+
2861
+ /**
2862
+ * Set the HTML stripping function to be used by DataTables.
2863
+ *
2864
+ * @param stripFunction Function to use for HTML stripping in DataTables.
2865
+ */
2866
+ stripHtml(stripFunction: (str: string) => string): void;
2289
2867
 
2290
2868
  /**
2291
2869
  * Throttle the calls to a method to reduce call frequency. Since: 1.10.3
@@ -2295,6 +2873,13 @@ export interface DataTablesStaticUtil {
2295
2873
  * @returns Wrapper function that can be called and will automatically throttle calls to the passed in function to the given period.
2296
2874
  */
2297
2875
  throttle(fn: (data: any) => void, period?: number): (() => void);
2876
+
2877
+ /**
2878
+ * Get unique values from an array.
2879
+ *
2880
+ * @returns Array with unique values
2881
+ */
2882
+ unique<T=any>(input: Array<T>): Array<T>;
2298
2883
  }
2299
2884
 
2300
2885
 
@@ -2335,7 +2920,9 @@ export interface AjaxResponse {
2335
2920
  error?: string;
2336
2921
  }
2337
2922
 
2338
- interface AjaxSettings extends JQueryAjaxSettings {
2923
+ export type AjaxDataSrc = string | ((data: any) => any[]);
2924
+
2925
+ export interface AjaxSettings extends JQueryAjaxSettings {
2339
2926
  /**
2340
2927
  * Add or modify data submitted to the server upon an Ajax request.
2341
2928
  */
@@ -2344,7 +2931,19 @@ interface AjaxSettings extends JQueryAjaxSettings {
2344
2931
  /**
2345
2932
  * Data property or manipulation method for table data.
2346
2933
  */
2347
- dataSrc?: string | ((data: any) => any[]);
2934
+ dataSrc?: AjaxDataSrc | {
2935
+ /** Mapping for `data` property */
2936
+ data: AjaxDataSrc;
2937
+
2938
+ /** Mapping for `draw` property */
2939
+ draw: AjaxDataSrc;
2940
+
2941
+ /** Mapping for `recordsTotal` property */
2942
+ recordsTotal: AjaxDataSrc;
2943
+
2944
+ /** Mapping for `recordsFiltered` property */
2945
+ recordsFiltered: AjaxDataSrc;
2946
+ };
2348
2947
  }
2349
2948
 
2350
2949
  interface FunctionColumnData {
@@ -2368,7 +2967,7 @@ interface ObjectColumnRender {
2368
2967
  sort?: string | number | FunctionColumnRender;
2369
2968
  }
2370
2969
 
2371
- interface CellMetaSettings {
2970
+ export interface CellMetaSettings {
2372
2971
  row: number;
2373
2972
  col: number;
2374
2973
  settings: InternalSettings;
@@ -2376,7 +2975,7 @@ interface CellMetaSettings {
2376
2975
 
2377
2976
  export interface DataTablesStaticExt {
2378
2977
  builder: string;
2379
- buttons: {[key: string]: object};
2978
+ buttons: DataTablesStaticExtButtons;
2380
2979
  classes: ExtClassesSettings;
2381
2980
  errMode: string;
2382
2981
  feature: any[];
@@ -2396,6 +2995,10 @@ export interface DataTablesStaticExt {
2396
2995
  type: ExtTypeSettings;
2397
2996
  }
2398
2997
 
2998
+ export interface DataTablesStaticExtButtons {
2999
+ // Intentionally empty, completed in Buttons extension
3000
+ }
3001
+
2399
3002
  /**
2400
3003
  * Classes used by DataTables. Used for styling integration. Note
2401
3004
  * that these all use legacy Hungarian notation.
@@ -2415,7 +3018,7 @@ export interface DataTablesStaticExt {
2415
3018
 
2416
3019
  /**
2417
3020
  * Default Value:
2418
- * paginate_button
3021
+ * dt-paging-button
2419
3022
  */
2420
3023
  sPageButton?: string;
2421
3024
 
@@ -2445,43 +3048,43 @@ export interface DataTablesStaticExt {
2445
3048
 
2446
3049
  /**
2447
3050
  * Default Value:
2448
- * dataTables_empty
3051
+ * dt-empty
2449
3052
  */
2450
3053
  sRowEmpty?: string;
2451
3054
 
2452
3055
  /**
2453
3056
  * Default Value:
2454
- * dataTables_wrapper
3057
+ * dt-container
2455
3058
  */
2456
3059
  sWrapper?: string;
2457
3060
 
2458
3061
  /**
2459
3062
  * Default Value:
2460
- * dataTables_filter
3063
+ * dt-search
2461
3064
  */
2462
3065
  sFilter?: string;
2463
3066
 
2464
3067
  /**
2465
3068
  * Default Value:
2466
- * dataTables_info
3069
+ * dt-info
2467
3070
  */
2468
3071
  sInfo?: string;
2469
3072
 
2470
3073
  /**
2471
3074
  * Default Value:
2472
- * dataTables_paginate paging_
3075
+ * dt-paging paging_
2473
3076
  */
2474
3077
  sPaging?: string;
2475
3078
 
2476
3079
  /**
2477
3080
  * Default Value:
2478
- * dataTables_length
3081
+ * dt-length
2479
3082
  */
2480
3083
  sLength?: string;
2481
3084
 
2482
3085
  /**
2483
3086
  * Default Value:
2484
- * dataTables_processing
3087
+ * dt-processing
2485
3088
  */
2486
3089
  sProcessing?: string;
2487
3090
 
@@ -2538,31 +3141,31 @@ export interface DataTablesStaticExt {
2538
3141
 
2539
3142
  /**
2540
3143
  * Default Value:
2541
- * dataTables_scrollHead
3144
+ * dt-scroll-head
2542
3145
  */
2543
3146
  sScrollHead?: string;
2544
3147
 
2545
3148
  /**
2546
3149
  * Default Value:
2547
- * dataTables_scrollHeadInner
3150
+ * dt-scroll-headInner
2548
3151
  */
2549
3152
  sScrollHeadInner?: string;
2550
3153
 
2551
3154
  /**
2552
3155
  * Default Value:
2553
- * dataTables_scrollBody
3156
+ * dt-scroll-body
2554
3157
  */
2555
3158
  sScrollBody?: string;
2556
3159
 
2557
3160
  /**
2558
3161
  * Default Value:
2559
- * dataTables_scrollFoot
3162
+ * dt-scroll-foot
2560
3163
  */
2561
3164
  sScrollFoot?: string;
2562
3165
 
2563
3166
  /**
2564
3167
  * Default Value:
2565
- * dataTables_scrollFootInner
3168
+ * dt-scroll-footInner
2566
3169
  */
2567
3170
  sScrollFootInner?: string;
2568
3171