UNPKG

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