UNPKG

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