UNPKG

67.6 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(fn: (this: CellMethods, cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api;
688
689 /**
690 * Get index information about the selected cells
691 */
692 indexes(): Api;
693
694 /**
695 * Get the DOM elements for the selected cells
696 */
697 nodes(): Api;
698 }
699 //#endregion "cell-methods"
700
701 //#region "column-methods"
702
703 interface CommonColumnMethod extends CommonSubMethods {
704 /**
705 * Get the footer th / td cell for the selected column.
706 */
707 footer(): HTMLElement;
708
709 /**
710 * Get the header th / td cell for a column.
711 */
712 header(): HTMLElement;
713
714 /**
715 * Order the table, in the direction specified, by the column selected by the column()DT selector.
716 *
717 * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending).
718 */
719 order(direction: string): Api;
720
721 /**
722 * Get the visibility of the selected column.
723 */
724 visible(): boolean;
725
726 /**
727 * Set the visibility of the selected column.
728 *
729 * @param show Specify if the column should be visible (true) or not (false).
730 * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false).
731 */
732 visible(show: boolean, redrawCalculations?: boolean): Api;
733 }
734
735 interface ColumnMethodsModel {
736 /**
737 * Select the column found by a column selector
738 *
739 * @param cellSelector Cell selector.
740 * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
741 */
742 (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnMethods;
743
744 /**
745 * Convert from the input column index type to that required.
746 *
747 * @param t The type on conversion that should take place: 'fromVisible', 'toData', 'fromData', 'toVisible'
748 * @param index The index to be converted
749 */
750 index(t: string, index: number): number;
751 }
752
753 interface ColumnMethods extends CoreMethods, CommonColumnMethod {
754 /**
755 * Get the data for the cells in the selected column.
756 */
757 data(): Api;
758
759 /**
760 * Get the data source property for the selected column
761 */
762 dataSrc(): number | string | (() => string);
763
764 /**
765 * Get index information about the selected cell
766 *
767 * @param t Specify if you want to get the column data index (default) or the visible index (visible).
768 */
769 index(t?: string): number;
770
771 /**
772 * Obtain the th / td nodes for the selected column
773 */
774 nodes(): Api;
775 }
776
777 interface ColumnsMethodsModel {
778 /**
779 * Select all columns
780 *
781 * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
782 */
783 (modifier?: ObjectSelectorModifier): ColumnsMethods;
784
785 /**
786 * Select columns found by a cell selector
787 *
788 * @param cellSelector Cell selector.
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 (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnsMethods;
792
793 /**
794 * Recalculate the column widths for layout.
795 */
796 adjust(): Api;
797 }
798
799 interface ColumnsMethods extends CoreMethods, CommonColumnMethod {
800 /**
801 * Obtain the data for the columns from the selector
802 */
803 data(): Api;
804
805 /**
806 * Get the data source property for the selected columns.
807 */
808 dataSrc(): Api;
809
810 /**
811 * Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6
812 *
813 * @param fn Function to execute for every column selected.
814 */
815 every(fn: (this: ColumnMethods, colIdx: number, tableLoop: number, colLoop: number) => void): Api;
816
817 /**
818 * Get the column indexes of the selected columns.
819 *
820 * @param t Specify if you want to get the column data index (default) or the visible index (visible).
821 */
822 indexes(t?: string): Api;
823
824 /**
825 * Obtain the th / td nodes for the selected columns
826 */
827 nodes(): Api[][];
828 }
829 //#endregion "column-methods"
830
831 //#region "row-methods"
832
833 interface CommonRowMethod extends CommonSubMethods {
834 /**
835 * Obtain the th / td nodes for the selected column
836 *
837 * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom'
838 */
839 invalidate(source?: string): Api;
840 }
841
842 interface RowChildMethodModel {
843 /**
844 * Get the child row(s) that have been set for a parent row
845 */
846 (): JQuery;
847
848 /**
849 * Get the child row(s) that have been set for a parent row
850 *
851 * @param showRemove This parameter can be given as true or false
852 */
853 (showRemove: boolean): RowChildMethods;
854
855 /**
856 * 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.
857 *
858 * @param data The data to be shown in the child row can be given in multiple different ways.
859 * @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).
860 */
861 (data: (string | Node | JQuery) | Array<(string | number | JQuery)>, className?: string): RowChildMethods;
862
863 /**
864 * Hide the child row(s) of a parent row
865 */
866 hide(): Api;
867
868 /**
869 * Check if the child rows of a parent row are visible
870 */
871 isShown(): Api;
872
873 /**
874 * Remove child row(s) from display and release any allocated memory
875 */
876 remove(): Api;
877
878 /**
879 * Show the child row(s) of a parent row
880 */
881 show(): Api;
882 }
883
884 interface RowChildMethods extends CoreMethods {
885 /**
886 * Hide the child row(s) of a parent row
887 */
888 hide(): Api;
889
890 /**
891 * Remove child row(s) from display and release any allocated memory
892 */
893 remove(): Api;
894
895 /**
896 * Make newly defined child rows visible
897 */
898 show(): Api;
899 }
900
901 interface RowMethodsModel {
902 /**
903 * Select a row found by a row selector
904 *
905 * @param rowSelector Row selector.
906 * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
907 */
908 (rowSelector: any, modifier?: ObjectSelectorModifier): RowMethods;
909
910 /**
911 * Add a new row to the table using the given data
912 *
913 * @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
914 */
915 add(data: any[] | object): Api;
916 }
917
918 interface RowMethods extends CoreMethods, CommonRowMethod {
919 /**
920 * Order Methods / object
921 */
922 child: RowChildMethodModel;
923
924 /**
925 * Get the data for the selected row
926 */
927 data(): any[] | object;
928
929 /**
930 * Set the data for the selected row
931 *
932 * @param d Data to use for the row.
933 */
934 data(d: any[] | object): Api;
935
936 /**
937 * Get the id of the selected row. Since: 1.10.8
938 *
939 * @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
940 * false - Do not modify the id value.
941 * @returns Row id. If the row does not have an id available 'undefined' will be returned.
942 */
943 id(hash?: boolean): string;
944
945 /**
946 * Get the row index of the row column.
947 */
948 index(): number;
949
950 /**
951 * Obtain the tr node for the selected row
952 */
953 node(): Node;
954
955 /**
956 * Delete the selected row from the DataTable.
957 */
958 remove(): Node;
959 }
960
961 interface RowsMethodsModel {
962 /**
963 * Select all rows
964 *
965 * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
966 */
967 (modifier?: ObjectSelectorModifier): RowsMethods;
968
969 /**
970 * Select rows found by a row selector
971 *
972 * @param cellSelector Row selector.
973 * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
974 */
975 (rowSelector: any, modifier?: ObjectSelectorModifier): RowsMethods;
976
977 /**
978 * Add new rows to the table using the data given
979 *
980 * @param data Array of data elements, with each one describing a new row to be added to the table
981 */
982 add(data: any[]): Api;
983 }
984
985 interface RowsMethods extends CoreMethods, CommonRowMethod {
986 /**
987 * Get / Set the data for the selected row
988 *
989 * @param d Data to use for the row.
990 */
991 data(d?: any[] | object): Api;
992
993 /**
994 * Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6
995 *
996 * @param fn Function to execute for every row selected.
997 */
998 every(fn: (this: RowMethods, rowIdx: number, tableLoop: number, rowLoop: number) => void): Api;
999
1000 /**
1001 * Get the ids of the selected rows. Since: 1.10.8
1002 *
1003 * @param hash true - Append a hash (#) to the start of each row id. This can be useful for then using the ids as selectors
1004 * false - Do not modify the id value.
1005 * @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.
1006 */
1007 ids(hash?: boolean): Api;
1008
1009 /**
1010 * Get the row indexes of the selected rows.
1011 */
1012 indexes(): Api;
1013
1014 /**
1015 * Obtain the tr nodes for the selected rows
1016 */
1017 nodes(): Api;
1018
1019 /**
1020 * Delete the selected rows from the DataTable.
1021 */
1022 remove(): Api;
1023 }
1024 //#endregion "row-methods"
1025
1026 //#region "table-methods"
1027
1028 interface TableMethods extends CoreMethods {
1029 /**
1030 * Get the tfoot node for the table in the API's context
1031 */
1032 footer(): Node;
1033
1034 /**
1035 * Get the thead node for the table in the API's context
1036 */
1037 header(): Node;
1038
1039 /**
1040 * Get the tbody node for the table in the API's context
1041 */
1042 body(): Node;
1043
1044 /**
1045 * Get the div container node for the table in the API's context
1046 */
1047 container(): Node;
1048
1049 /**
1050 * Get the table node for the table in the API's context
1051 */
1052 node(): Node;
1053 }
1054
1055 interface TablesMethods extends CoreMethods {
1056 /**
1057 * Get the tfoot nodes for the tables in the API's context
1058 */
1059 footer(): Api;
1060
1061 /**
1062 * Get the thead nodes for the tables in the API's context
1063 */
1064 header(): Api;
1065
1066 /**
1067 * Get the tbody nodes for the tables in the API's context
1068 */
1069 body(): Api;
1070
1071 /**
1072 * Get the div container nodes for the tables in the API's context
1073 */
1074 containers(): Api;
1075
1076 /**
1077 * Get the table nodes for the tables in the API's context
1078 */
1079 nodes(): Api;
1080 }
1081 //#endregion "table-methods"
1082
1083 //#endregion "Namespaces"
1084
1085 //#region "Static-Methods"
1086
1087 interface StaticFunctions {
1088 /**
1089 * Returns JQuery object
1090 *
1091 * Usage:
1092 * $( selector ).dataTable();
1093 */
1094 (): JQueryDataTables;
1095
1096 /**
1097 * Check if a table node is a DataTable already or not.
1098 *
1099 * Usage:
1100 * $.fn.dataTable.isDataTable("selector");
1101 * @param table The table to check.
1102 */
1103 isDataTable(table: string | Node | JQuery | Api): boolean;
1104
1105 /**
1106 * Helpers for `columns.render`.
1107 *
1108 * The options defined here can be used with the `columns.render` initialisation
1109 * option to provide a display renderer.
1110 */
1111 render: StaticRenderFunctions;
1112
1113 /**
1114 * 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.
1115 *
1116 * @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).
1117 * Since 1.10.8 this option can also be given as an object.
1118 */
1119 tables(visible?: boolean | objectTablesStatic): Api[] | Api;
1120
1121 /**
1122 * Version number compatibility check function
1123 *
1124 * Usage:
1125 * $.fn.dataTable.versionCheck("1.10.0");
1126 * @param version Version string
1127 */
1128 versionCheck(version: string): boolean;
1129
1130 /**
1131 * Utils
1132 */
1133 util: StaticUtilFunctions;
1134
1135 /**
1136 * Get DataTable API instance
1137 *
1138 * @param table Selector string for table
1139 */
1140 Api: new (selector: string | Node | Node[] | JQuery | SettingsLegacy) => Api;
1141
1142 /**
1143 * Default Settings
1144 */
1145 defaults: Settings;
1146
1147 /**
1148 * Default Settings
1149 */
1150 ext: ExtSettings;
1151 }
1152
1153 interface ObjectOrderFixed {
1154 /**
1155 * Two-element array:
1156 * 0: Column index to order upon.
1157 * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order).
1158 */
1159 pre?: any[] | undefined;
1160 /**
1161 * Two-element array:
1162 * 0: Column index to order upon.
1163 * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order).
1164 */
1165 post?: any[] | undefined;
1166 }
1167
1168 interface StaticRenderFunctions {
1169 /**
1170 * Will format numeric data (defined by `columns.data`) for display, retaining the original unformatted data for sorting and filtering.
1171 *
1172 * @param thousands Thousands grouping separator.
1173 * @param decimal Decimal point indicator.
1174 * @param precision Integer number of decimal points to show.
1175 * @param prefix Prefix (optional).
1176 * @param postfix Postfix (/suffix) (optional).
1177 */
1178 number(thousands: string, decimal: string, precision: number, prefix?: string, postfix?: string): ObjectColumnRender;
1179 /**
1180 * Escape HTML to help prevent XSS attacks. It has no optional parameters.
1181 */
1182 text(): ObjectColumnRender;
1183 }
1184
1185 interface StaticUtilFunctions {
1186 /**
1187 * Escape special characters in a regular expression string. Since: 1.10.4
1188 *
1189 * @param str String to escape
1190 */
1191 escapeRegex(str: string): string;
1192
1193 /**
1194 * Throttle the calls to a method to reduce call frequency. Since: 1.10.3
1195 *
1196 * @param fn Function
1197 * @param period ms
1198 */
1199 throttle(fn: FunctionThrottle, period?: number): (() => void);
1200 }
1201
1202 type FunctionThrottle = (data: any) => void;
1203
1204 interface objectTablesStatic {
1205 /**
1206 * Get only visible tables (true) or all tables regardless of visibility (false).
1207 */
1208 visible: boolean;
1209
1210 /**
1211 * Return a DataTables API instance for the selected tables (true) or an array (false).
1212 */
1213 api: boolean;
1214 }
1215
1216 //#endregion "Static-Methods"
1217
1218 //#region "Settings"
1219
1220 interface Settings {
1221 //#region "Features"
1222
1223 /**
1224 * Feature control DataTables' smart column width handling. Since: 1.10
1225 */
1226 autoWidth?: boolean | undefined;
1227
1228 /**
1229 * Feature control deferred rendering for additional speed of initialisation. Since: 1.10
1230 */
1231 deferRender?: boolean | undefined;
1232
1233 /**
1234 * Feature control table information display field. Since: 1.10
1235 */
1236 info?: boolean | undefined;
1237
1238 /**
1239 * Use markup and classes for the table to be themed by jQuery UI ThemeRoller. Since: 1.10
1240 */
1241 jQueryUI?: boolean | undefined;
1242
1243 /**
1244 * Feature control the end user's ability to change the paging display length of the table. Since: 1.10
1245 */
1246 lengthChange?: boolean | undefined;
1247
1248 /**
1249 * Feature control ordering (sorting) abilities in DataTables. Since: 1.10
1250 */
1251 ordering?: boolean | undefined;
1252
1253 /**
1254 * Enable or disable table pagination. Since: 1.10
1255 */
1256 paging?: boolean | undefined;
1257
1258 /**
1259 * Feature control the processing indicator. Since: 1.10
1260 */
1261 processing?: boolean | undefined;
1262
1263 /**
1264 * Horizontal scrolling. Since: 1.10
1265 */
1266 scrollX?: boolean | undefined;
1267
1268 /**
1269 * Vertical scrolling. Since: 1.10 Exp: "200px"
1270 */
1271 scrollY?: string | undefined;
1272
1273 /**
1274 * Feature control search (filtering) abilities Since: 1.10
1275 */
1276 searching?: boolean | undefined;
1277
1278 /**
1279 * Feature control DataTables' server-side processing mode. Since: 1.10
1280 */
1281 serverSide?: boolean | undefined;
1282
1283 /**
1284 * State saving - restore table state on page reload. Since: 1.10
1285 */
1286 stateSave?: boolean | undefined;
1287
1288 //#endregion "Features"
1289
1290 //#region "Data"
1291
1292 /**
1293 * Load data for the table's content from an Ajax source. Since: 1.10
1294 */
1295 ajax?: string | AjaxSettings | FunctionAjax | undefined;
1296
1297 /**
1298 * Data to use as the display data for the table. Since: 1.10
1299 */
1300 data?: any[] | undefined;
1301
1302 //#endregion "Data"
1303
1304 //#region "Options"
1305
1306 /**
1307 * Data to use as the display data for the table. Since: 1.10
1308 */
1309 columns?: ColumnSettings[] | undefined;
1310
1311 /**
1312 * Assign a column definition to one or more columns.. Since: 1.10
1313 */
1314 columnDefs?: ColumnDefsSettings[] | undefined;
1315
1316 /**
1317 * Delay the loading of server-side data until second draw
1318 */
1319 deferLoading?: number | number[] | undefined;
1320
1321 /**
1322 * Destroy any existing table matching the selector and replace with the new options. Since: 1.10
1323 */
1324 destroy?: boolean | undefined;
1325
1326 /**
1327 * Initial paging start point. Since: 1.10
1328 */
1329 displayStart?: number | undefined;
1330
1331 /**
1332 * Define the table control elements to appear on the page and in what order. Since: 1.10
1333 */
1334 dom?: string | undefined;
1335
1336 /**
1337 * Change the options in the page length select list. Since: 1.10
1338 */
1339 lengthMenu?: Array<(number | string)> | Array<Array<(number | string)>> | undefined;
1340
1341 /**
1342 * Control which cell the order event handler will be applied to in a column. Since: 1.10
1343 */
1344 orderCellsTop?: boolean | undefined;
1345
1346 /**
1347 * Highlight the columns being ordered in the table's body. Since: 1.10
1348 */
1349 orderClasses?: boolean | undefined;
1350
1351 /**
1352 * Initial order (sort) to apply to the table. Since: 1.10
1353 */
1354 order?: Array<(number | string)> | Array<Array<(number | string)>> | undefined;
1355
1356 /**
1357 * Ordering to always be applied to the table. Since: 1.10
1358 */
1359 orderFixed?: Array<(number | string)> | Array<Array<(number | string)>> | object | undefined;
1360
1361 /**
1362 * Multiple column ordering ability control. Since: 1.10
1363 */
1364 orderMulti?: boolean | undefined;
1365
1366 /**
1367 * Change the initial page length (number of rows per page). Since: 1.10
1368 */
1369 pageLength?: number | undefined;
1370
1371 /**
1372 * Pagination button display options. Basic Types: numbers (1.10.8) simple, simple_numbers, full, full_numbers
1373 */
1374 pagingType?: string | undefined;
1375
1376 /**
1377 * Retrieve an existing DataTables instance. Since: 1.10
1378 */
1379 retrieve?: boolean | undefined;
1380
1381 /**
1382 * Display component renderer types. Since: 1.10
1383 */
1384 renderer?: string | RendererSettings | undefined;
1385
1386 /**
1387 * Data property name that DataTables will use to set <tr> element DOM IDs. Since: 1.10.8
1388 */
1389 rowId?: string | ((data: any) => string) | undefined;
1390
1391 /**
1392 * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10
1393 */
1394 scrollCollapse?: boolean | undefined;
1395
1396 /**
1397 * Set an initial filter in DataTables and / or filtering options. Since: 1.10
1398 */
1399 search?: SearchSettings | boolean | undefined;
1400
1401 /**
1402 * Set placeholder attribute for input type="text" tag elements. Since: 1.10
1403 */
1404 searchPlaceholder?: SearchSettings | undefined;
1405
1406 /**
1407 * Define an initial search for individual columns. Since: 1.10
1408 */
1409 searchCols?: SearchSettings[] | undefined;
1410
1411 /**
1412 * Set a throttle frequency for searching. Since: 1.10
1413 */
1414 searchDelay?: number | undefined;
1415
1416 /**
1417 * Saved state validity duration. Since: 1.10
1418 */
1419 stateDuration?: number | undefined;
1420
1421 /**
1422 * Set the zebra stripe class names for the rows in the table. Since: 1.10
1423 */
1424 stripeClasses?: string[] | undefined;
1425
1426 /**
1427 * Tab index control for keyboard navigation. Since: 1.10
1428 */
1429 tabIndex?: number | undefined;
1430
1431 /**
1432 * Enable or disable datatables responsive. Since: 1.10
1433 */
1434 responsive?: boolean | object | undefined;
1435
1436 //#endregion "Options"
1437
1438 //#region "Callbacks"
1439
1440 /**
1441 * Callback for whenever a TR element is created for the table's body. Since: 1.10
1442 */
1443 createdRow?: FunctionCreateRow | undefined;
1444
1445 /**
1446 * Function that is called every time DataTables performs a draw. Since: 1.10
1447 */
1448 drawCallback?: FunctionDrawCallback | undefined;
1449
1450 /**
1451 * Footer display callback function. Since: 1.10
1452 */
1453 footerCallback?: FunctionFooterCallback | undefined;
1454
1455 /**
1456 * Number formatting callback function. Since: 1.10
1457 */
1458 formatNumber?: FunctionFormatNumber | undefined;
1459
1460 /**
1461 * Header display callback function. Since: 1.10
1462 */
1463 headerCallback?: FunctionHeaderCallback | undefined;
1464
1465 /**
1466 * Table summary information display callback. Since: 1.10
1467 */
1468 infoCallback?: FunctionInfoCallback | undefined;
1469
1470 /**
1471 * Initialisation complete callback. Since: 1.10
1472 */
1473 initComplete?: FunctionInitComplete | undefined;
1474
1475 /**
1476 * Pre-draw callback. Since: 1.10
1477 */
1478 preDrawCallback?: FunctionPreDrawCallback | undefined;
1479
1480 /**
1481 * Row draw callback.. Since: 1.10
1482 */
1483 rowCallback?: FunctionRowCallback | undefined;
1484
1485 /**
1486 * Callback that defines where and how a saved state should be loaded. Since: 1.10
1487 */
1488 stateLoadCallback?: FunctionStateLoadCallback | undefined;
1489
1490 /**
1491 * State loaded callback. Since: 1.10
1492 */
1493 stateLoaded?: FunctionStateLoaded | undefined;
1494
1495 /**
1496 * State loaded - data manipulation callback. Since: 1.10
1497 */
1498 stateLoadParams?: FunctionStateLoadParams | undefined;
1499
1500 /**
1501 * Callback that defines how the table state is stored and where. Since: 1.10
1502 */
1503 stateSaveCallback?: FunctionStateSaveCallback | undefined;
1504
1505 /**
1506 * State save - data manipulation callback. Since: 1.10
1507 */
1508 stateSaveParams?: FunctionStateSaveParams | undefined;
1509
1510 //#endregion "Callbacks"
1511
1512 //#region "Language"
1513
1514 language?: LanguageSettings | undefined;
1515
1516 //#endregion "Language"
1517 }
1518
1519 //#region "ajax-settings"
1520
1521 interface AjaxDataRequest {
1522 draw: number;
1523 start: number;
1524 length: number;
1525 data: any;
1526 order: AjaxDataRequestOrder[];
1527 columns: AjaxDataRequestColumn[];
1528 search: AjaxDataRequestSearch;
1529 }
1530
1531 interface AjaxDataRequestSearch {
1532 value: string;
1533 regex: boolean;
1534 }
1535
1536 interface AjaxDataRequestOrder {
1537 column: number;
1538 dir: string;
1539 }
1540
1541 interface AjaxDataRequestColumn {
1542 data: string | number;
1543 name: string;
1544 searchable: boolean;
1545 orderable: boolean;
1546 search: AjaxDataRequestSearch;
1547 }
1548
1549 interface AjaxData {
1550 draw?: number | undefined;
1551 recordsTotal?: number | undefined;
1552 recordsFiltered?: number | undefined;
1553 data: any;
1554 error?: string | undefined;
1555 }
1556
1557 interface AjaxSettings extends JQueryAjaxSettings {
1558 /**
1559 * Add or modify data submitted to the server upon an Ajax request. Since: 1.10
1560 */
1561 data?: object | FunctionAjaxData | undefined;
1562
1563 /**
1564 * Data property or manipulation method for table data. Since: 1.10
1565 */
1566 dataSrc?: string | ((data: any) => any[]) | undefined;
1567 }
1568
1569 type FunctionAjax = (data: object, callback: ((data: any) => void), settings: SettingsLegacy) => void;
1570
1571 type FunctionAjaxData = (data: object, settings: Settings) => string | object;
1572
1573 //#endregion "ajax-settings"
1574
1575 //#region "colunm-settings"
1576
1577 interface ColumnSettings {
1578 /**
1579 * Cell type to be created for a column. th/td Since: 1.10
1580 */
1581 cellType?: string | undefined;
1582
1583 /**
1584 * Class to assign to each cell in the column. Since: 1.10
1585 */
1586 className?: string | undefined;
1587
1588 /**
1589 * Add padding to the text content used when calculating the optimal with for a table. Since: 1.10
1590 */
1591 contentPadding?: string | undefined;
1592
1593 /**
1594 * Cell created callback to allow DOM manipulation. Since: 1.10
1595 */
1596 createdCell?: FunctionColumnCreatedCell | undefined;
1597
1598 /**
1599 * Class to assign to each cell in the column. Since: 1.10
1600 */
1601 data?: number | string | ObjectColumnData | FunctionColumnData | null | undefined;
1602
1603 /**
1604 * Set default, static, content for a column. Since: 1.10
1605 */
1606 defaultContent?: string | undefined;
1607
1608 /**
1609 * Set a descriptive name for a column. Since: 1.10
1610 */
1611 name?: string | undefined;
1612
1613 /**
1614 * Enable or disable ordering on this column. Since: 1.10
1615 */
1616 orderable?: boolean | undefined;
1617
1618 /**
1619 * Define multiple column ordering as the default order for a column. Since: 1.10
1620 */
1621 orderData?: number | number[] | undefined;
1622
1623 /**
1624 * Live DOM sorting type assignment. Since: 1.10
1625 */
1626 orderDataType?: string | undefined;
1627
1628 /**
1629 * Ordering to always be applied to the table. Since 1.10
1630 *
1631 * Array type is prefix ordering only and is a two-element array:
1632 * 0: Column index to order upon.
1633 * 1: Direction so order to apply ("asc" for ascending order or "desc" for descending order).
1634 */
1635 orderFixed?: any[] | ObjectOrderFixed | undefined;
1636
1637 /**
1638 * Order direction application sequence. Since: 1.10
1639 */
1640 orderSequence?: string[] | undefined;
1641
1642 /**
1643 * Render (process) the data for use in the table. Since: 1.10
1644 */
1645 render?: number | string | ObjectColumnData | FunctionColumnRender | ObjectColumnRender | undefined;
1646
1647 /**
1648 * Enable or disable filtering on the data in this column. Since: 1.10
1649 */
1650 searchable?: boolean | undefined;
1651
1652 /**
1653 * Set the column title. Since: 1.10
1654 */
1655 title?: string | undefined;
1656
1657 /**
1658 * Set the column type - used for filtering and sorting string processing. Since: 1.10
1659 */
1660 type?: string | undefined;
1661
1662 /**
1663 * Enable or disable the display of this column. Since: 1.10
1664 */
1665 visible?: boolean | undefined;
1666
1667 /**
1668 * Column width assignment. Since: 1.10
1669 */
1670 width?: string | undefined;
1671 }
1672
1673 interface ColumnDefsSettings extends ColumnSettings {
1674 targets: string | number | Array<(number | string)>;
1675 }
1676
1677 type FunctionColumnCreatedCell = (cell: Node, cellData: any, rowData: any, row: number, col: number) => void;
1678
1679 interface FunctionColumnData {
1680 (row: any, t: 'set', s: any, meta: CellMetaSettings): void;
1681 (row: any, t: 'display' | 'sort' | 'filter' | 'type', s: undefined, meta: CellMetaSettings): any;
1682 }
1683
1684 interface ObjectColumnData {
1685 _: string | number | FunctionColumnData;
1686 filter?: string | number | FunctionColumnData | undefined;
1687 display?: string | number | FunctionColumnData | undefined;
1688 type?: string | number | FunctionColumnData | undefined;
1689 sort?: string | number | FunctionColumnData | undefined;
1690 }
1691
1692 type FunctionColumnRender = (data: any, type: any, row: any, meta: CellMetaSettings) => any;
1693
1694 interface ObjectColumnRender {
1695 _?: string | number | FunctionColumnRender | undefined;
1696 filter?: string | number | FunctionColumnRender | undefined;
1697 display?: string | number | FunctionColumnRender | undefined;
1698 type?: string | number | FunctionColumnRender | undefined;
1699 sort?: string | number | FunctionColumnRender | undefined;
1700 }
1701
1702 interface CellMetaSettings {
1703 row: number;
1704 col: number;
1705 settings: Settings;
1706 }
1707
1708 //#endregion "colunm-settings"
1709
1710 //#region "other-settings"
1711
1712 interface RendererSettings {
1713 header?: string | undefined;
1714 pageButton?: string | undefined;
1715 }
1716
1717 interface SearchSettings {
1718 /**
1719 * Control case-sensitive filtering option. Since: 1.10
1720 */
1721 caseInsensitive?: boolean | undefined;
1722
1723 /**
1724 * Enable / disable escaping of regular expression characters in the search term. Since: 1.10
1725 */
1726 regex?: boolean | undefined;
1727
1728 /**
1729 * Enable / disable DataTables' smart filtering. Since: 1.10
1730 */
1731 smart?: boolean | undefined;
1732
1733 /**
1734 * Set an initial filtering condition on the table. Since: 1.10
1735 */
1736 search?: string | undefined;
1737
1738 /**
1739 * Set a placeholder attribute for input type="text" tag elements. Since: 1.10.1
1740 */
1741 searchPlaceholder?: string | undefined;
1742 }
1743
1744 //#endregion "other-settings"
1745
1746 //#region "callback-functions"
1747
1748 type FunctionCreateRow = (row: Node, data: any[] | object, dataIndex: number) => void;
1749
1750 type FunctionDrawCallback = (settings: SettingsLegacy) => void;
1751
1752 type FunctionFooterCallback = (tfoot: Node, data: any[], start: number, end: number, display: any[]) => void;
1753
1754 type FunctionFormatNumber = (formatNumber: number) => void;
1755
1756 type FunctionHeaderCallback = (thead: Node, data: any[], start: number, end: number, display: any[]) => void;
1757
1758 type FunctionInfoCallback = (settings: SettingsLegacy, start: number, end: number, mnax: number, total: number, pre: string) => void;
1759
1760 type FunctionInitComplete = (settings: SettingsLegacy, json: object) => void;
1761
1762 type FunctionPreDrawCallback = (settings: SettingsLegacy) => void;
1763
1764 type FunctionRowCallback = (row: Node, data: any[] | object, index: number) => void;
1765
1766 type FunctionStateLoadCallback = (settings: SettingsLegacy) => void;
1767
1768 type FunctionStateLoaded = (settings: SettingsLegacy, data: object) => void;
1769
1770 type FunctionStateLoadParams = (settings: SettingsLegacy, data: object) => void;
1771
1772 type FunctionStateSaveCallback = (settings: SettingsLegacy, data: object) => void;
1773
1774 type FunctionStateSaveParams = (settings: SettingsLegacy, data: object) => void;
1775
1776 //#endregion "callback-functions"
1777
1778 //#region "language-settings"
1779
1780 // these are all optional
1781 interface LanguageSettings {
1782 emptyTable?: string | undefined;
1783 info?: string | undefined;
1784 infoEmpty?: string | undefined;
1785 infoFiltered?: string | undefined;
1786 infoPostFix?: string | undefined;
1787 decimal?: string | undefined;
1788 thousands?: string | undefined;
1789 lengthMenu?: string | undefined;
1790 loadingRecords?: string | undefined;
1791 processing?: string | undefined;
1792 search?: string | undefined;
1793 searchPlaceholder?: string | undefined;
1794 zeroRecords?: string | undefined;
1795 paginate?: LanguagePaginateSettings | undefined;
1796 aria?: LanguageAriaSettings | undefined;
1797 url?: string | undefined;
1798 }
1799
1800 interface LanguagePaginateSettings {
1801 first: string;
1802 last: string;
1803 next: string;
1804 previous: string;
1805 }
1806
1807 interface LanguageAriaSettings {
1808 sortAscending: string;
1809 sortDescending: string;
1810 paginate?: LanguagePaginateSettings | undefined;
1811 }
1812
1813 //#endregion "language-settings"
1814
1815 //#endregion "Settings"
1816
1817 //#region "SettingsLegacy"
1818
1819 interface ArrayStringNode {
1820 [index: string]: Node;
1821 }
1822
1823 interface SettingsLegacy {
1824 ajax: any;
1825 oApi: any;
1826 oFeatures: FeaturesLegacy;
1827 oScroll: ScrollingLegacy;
1828 oLanguage: LanguageLegacy; // | { fnInfoCallback: FunctionInfoCallback; };
1829 oBrowser: BrowserLegacy;
1830 aanFeatures: ArrayStringNode[][];
1831 aoData: RowLegacy[];
1832 aIds: any;
1833 aiDisplay: number[];
1834 aiDisplayMaster: number[];
1835 aoColumns: ColumnLegacy[];
1836 aoHeader: any[];
1837 aoFooter: any[];
1838 asDataSearch: string[];
1839 oPreviousSearch: any;
1840 aoPreSearchCols: any[];
1841 aaSorting: any[][];
1842 aaSortingFixed: any[][];
1843 asStripeClasses: string[];
1844 asDestroyStripes: string[];
1845 sDestroyWidth: number;
1846 aoRowCallback: FunctionRowCallback[];
1847 aoHeaderCallback: FunctionHeaderCallback[];
1848 aoFooterCallback: FunctionFooterCallback[];
1849 aoDrawCallback: FunctionDrawCallback[];
1850 aoRowCreatedCallback: FunctionCreateRow[];
1851 aoPreDrawCallback: FunctionPreDrawCallback[];
1852 aoInitComplete: FunctionInitComplete[];
1853 aoStateSaveParams: FunctionStateSaveParams[];
1854 aoStateLoadParams: FunctionStateLoadParams[];
1855 aoStateLoaded: FunctionStateLoaded[];
1856 sTableId: string;
1857 nTable: Node;
1858 nTHead: Node;
1859 nTFoot: Node;
1860 nTBody: Node;
1861 nTableWrapper: Node;
1862 bDeferLoading: boolean;
1863 bInitialized: boolean;
1864 aoOpenRows: any[];
1865 sDom: string;
1866 sPaginationType: string;
1867 iCookieDuration: number;
1868 sCookiePrefix: string;
1869 fnCookieCallback: CookieCallbackLegacy;
1870 aoStateSave: FunctionStateSaveCallback[];
1871 aoStateLoad: FunctionStateLoadCallback[];
1872 oLoadedState: any;
1873 sAjaxSource: string;
1874 sAjaxDataProp: string;
1875 bAjaxDataGet: boolean;
1876 jqXHR: any;
1877 fnServerData: any;
1878 aoServerParams: any[];
1879 sServerMethod: string;
1880 fnFormatNumber: FunctionFormatNumber;
1881 aLengthMenu: any[];
1882 iDraw: number;
1883 bDrawing: boolean;
1884 iDrawError: number;
1885 _iDisplayLength: number;
1886 _iDisplayStart: number;
1887 _iDisplayEnd: number;
1888 _iRecordsTotal: number;
1889 _iRecordsDisplay: number;
1890 bJUI: boolean;
1891 oClasses: any;
1892 bFiltered: boolean;
1893 bSorted: boolean;
1894 bSortCellsTop: boolean;
1895 oInit: any;
1896 aoDestroyCallback: any[];
1897 fnRecordsTotal(): number;
1898 fnRecordsDisplay(): number;
1899 fnDisplayEnd(): number;
1900 oInstance: any;
1901 sInstance: string;
1902 iTabIndex: number;
1903 nScrollHead: Node;
1904 nScrollFoot: Node;
1905 rowIdFn(mSource: string | number | (() => void)): (() => void);
1906 }
1907
1908 interface BrowserLegacy {
1909 barWidth: number;
1910 bBounding: boolean;
1911 bScrollbarLeft: boolean;
1912 bScrollOversize: boolean;
1913 }
1914
1915 interface FeaturesLegacy {
1916 bAutoWidth: boolean;
1917 bDeferRender: boolean;
1918 bFilter: boolean;
1919 bInfo: boolean;
1920 bLengthChange: boolean;
1921 bPaginate: boolean;
1922 bProcessing: boolean;
1923 bServerSide: boolean;
1924 bSort: boolean;
1925 bSortClasses: boolean;
1926 bStateSave: boolean;
1927 }
1928
1929 interface ScrollingLegacy {
1930 bAutoCss: boolean;
1931 bCollapse: boolean;
1932 bInfinite: boolean;
1933 iBarWidth: number;
1934 iLoadGap: number;
1935 sX: string;
1936 sY: string;
1937 }
1938
1939 interface RowLegacy {
1940 nTr: Node;
1941 _aData: any;
1942 _aSortData: any[];
1943 _anHidden: Node[];
1944 _sRowStripe: string;
1945 }
1946
1947 interface ColumnLegacy {
1948 idx: number;
1949 aDataSort: any;
1950 asSorting: string[];
1951 bSearchable: boolean;
1952 bSortable: boolean;
1953 bVisible: boolean;
1954 _bAutoType: boolean;
1955 fnCreatedCell: FunctionColumnCreatedCell;
1956 fnGetData(data: any, specific: string): any;
1957 fnSetData(data: any, value: any): void;
1958 mData: any;
1959 mRender: any;
1960 nTh: Node;
1961 nIf: Node;
1962 sClass: string;
1963 sContentPadding: string;
1964 sDefaultContent: string;
1965 sName: string;
1966 sSortDataType: string;
1967 sSortingClass: string;
1968 sSortingClassJUI: string;
1969 sTitle: string;
1970 sType: string;
1971 sWidth: string;
1972 sWidthOrig: string;
1973 }
1974
1975 type CookieCallbackLegacy = (name: string, data: any, expires: string, path: string, cookie: string) => void;
1976
1977 interface LanguageLegacy {
1978 oAria?: LanguageAriaLegacy | undefined;
1979 oPaginate?: LanguagePaginateLegacy | undefined;
1980 sEmptyTable?: string | undefined;
1981 sInfo?: string | undefined;
1982 sInfoEmpty?: string | undefined;
1983 sInfoFiltered?: string | undefined;
1984 sInfoPostFix?: string | undefined;
1985 sInfoThousands?: string | undefined;
1986 sLengthMenu?: string | undefined;
1987 sLoadingRecords?: string | undefined;
1988 sProcessing?: string | undefined;
1989 sSearch?: string | undefined;
1990 sUrl?: string | undefined;
1991 sZeroRecords?: string | undefined;
1992 }
1993
1994 interface LanguageAriaLegacy {
1995 sSortAscending?: string | undefined;
1996 sSortDescending?: string | undefined;
1997 }
1998
1999 interface LanguagePaginateLegacy {
2000 sFirst?: string | undefined;
2001 sLast?: string | undefined;
2002 sNext?: string | undefined;
2003 sPrevious?: string | undefined;
2004 }
2005 //#endregion "SettingsLegacy"
2006
2007 //#region "ext internal"
2008
2009 interface ExtSettings {
2010 aTypes: any[];
2011 afnFiltering: any[];
2012 afnSortData: object;
2013 aoFeatures: any[];
2014 builder: string;
2015 classes: ExtClassesSettings;
2016 errMode: string;
2017 feature: any[];
2018 fnVersionCheck(version: string): string;
2019 iApiIndex: number;
2020 internal: object;
2021 legacy: object;
2022 oApi: object;
2023 oJUIClasses: object;
2024 oPagination: object;
2025 oSort: object;
2026 oStdClasses: ExtClassesSettings;
2027 ofnSearch: object;
2028 order: object;
2029 pager: object;
2030 renderer: object;
2031 sVersion: string;
2032 search: any[];
2033 selector: object;
2034 /**
2035 * Type based plug-ins.
2036 */
2037 type: ExtTypeSettings;
2038 }
2039
2040 interface ExtClassesSettings {
2041 /**
2042 * Default Value:
2043 * dataTable
2044 */
2045 sTable?: string | undefined;
2046
2047 /**
2048 * Default Value:
2049 * no-footer
2050 */
2051 sNoFooter?: string | undefined;
2052
2053 /**
2054 * Default Value:
2055 * paginate_button
2056 */
2057 sPageButton?: string | undefined;
2058
2059 /**
2060 * Default Value:
2061 * current
2062 */
2063 sPageButtonActive?: string | undefined;
2064
2065 /**
2066 * Default Value:
2067 * disabled
2068 */
2069 sPageButtonDisabled?: string | undefined;
2070
2071 /**
2072 * Default Value:
2073 * odd
2074 */
2075 sStripeOdd?: string | undefined;
2076
2077 /**
2078 * Default Value:
2079 * even
2080 */
2081 sStripeEven?: string | undefined;
2082
2083 /**
2084 * Default Value:
2085 * dataTables_empty
2086 */
2087 sRowEmpty?: string | undefined;
2088
2089 /**
2090 * Default Value:
2091 * dataTables_wrapper
2092 */
2093 sWrapper?: string | undefined;
2094
2095 /**
2096 * Default Value:
2097 * dataTables_filter
2098 */
2099 sFilter?: string | undefined;
2100
2101 /**
2102 * Default Value:
2103 * dataTables_info
2104 */
2105 sInfo?: string | undefined;
2106
2107 /**
2108 * Default Value:
2109 * dataTables_paginate paging_
2110 */
2111 sPaging?: string | undefined;
2112
2113 /**
2114 * Default Value:
2115 * dataTables_length
2116 */
2117 sLength?: string | undefined;
2118
2119 /**
2120 * Default Value:
2121 * dataTables_processing
2122 */
2123 sProcessing?: string | undefined;
2124
2125 /**
2126 * Default Value:
2127 * sorting_asc
2128 */
2129 sSortAsc?: string | undefined;
2130
2131 /**
2132 * Default Value:
2133 * sorting_desc
2134 */
2135 sSortDesc?: string | undefined;
2136
2137 /**
2138 * Default Value:
2139 * sorting
2140 */
2141 sSortable?: string | undefined;
2142
2143 /**
2144 * Default Value:
2145 * sorting_asc_disabled
2146 */
2147 sSortableAsc?: string | undefined;
2148
2149 /**
2150 * Default Value:
2151 * sorting_desc_disabled
2152 */
2153 sSortableDesc?: string | undefined;
2154
2155 /**
2156 * Default Value:
2157 * sorting_disabled
2158 */
2159 sSortableNone?: string | undefined;
2160
2161 /**
2162 * Default Value:
2163 * sorting_
2164 */
2165 sSortColumn?: string | undefined;
2166
2167 sFilterInput?: string | undefined;
2168 sLengthSelect?: string | undefined;
2169
2170 /**
2171 * Default Value:
2172 * dataTables_scroll
2173 */
2174 sScrollWrapper?: string | undefined;
2175
2176 /**
2177 * Default Value:
2178 * dataTables_scrollHead
2179 */
2180 sScrollHead?: string | undefined;
2181
2182 /**
2183 * Default Value:
2184 * dataTables_scrollHeadInner
2185 */
2186 sScrollHeadInner?: string | undefined;
2187
2188 /**
2189 * Default Value:
2190 * dataTables_scrollBody
2191 */
2192 sScrollBody?: string | undefined;
2193
2194 /**
2195 * Default Value:
2196 * dataTables_scrollFoot
2197 */
2198 sScrollFoot?: string | undefined;
2199
2200 /**
2201 * Default Value:
2202 * dataTables_scrollFootInner
2203 */
2204 sScrollFootInner?: string | undefined;
2205
2206 sHeaderTH?: string | undefined;
2207 sFooterTH?: string | undefined;
2208 sSortJUIAsc?: string | undefined;
2209 sSortJUIDesc?: string | undefined;
2210 sSortJUI?: string | undefined;
2211 sSortJUIAscAllowed?: string | undefined;
2212 sSortJUIDescAllowed?: string | undefined;
2213 sSortJUIWrapper?: string | undefined;
2214 sSortIcon?: string | undefined;
2215 sJUIHeader?: string | undefined;
2216 sJUIFooter?: string | undefined;
2217 }
2218 //#endregion "ext internal"
2219
2220 interface ExtTypeSettings {
2221 /**
2222 * Type detection functions for plug-in development.
2223 *
2224 * @see https://datatables.net/manual/plug-ins/type-detection
2225 */
2226 detect: FunctionExtTypeSettingsDetect[];
2227 /**
2228 * Type based ordering functions for plug-in development.
2229 *
2230 * @see https://datatables.net/manual/plug-ins/sorting
2231 * @default {}
2232 */
2233 order: object;
2234 /**
2235 * Type based search formatting for plug-in development.
2236 *
2237 * @default {}
2238 * @example
2239 * $.fn.dataTable.ext.type.search['title-numeric'] = function ( d ) {
2240 * return d.replace(/\n/g," ").replace( /<.*?>/g, "" );
2241 * }
2242 */
2243 search: object;
2244 }
2245
2246 /**
2247 * @param data Data from the column cell to be analysed.
2248 * @param DataTables settings object.
2249 */
2250 type FunctionExtTypeSettingsDetect = (data: any, settings: Settings) => (string | null);
2251}