index.d.ts 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921
  1. // Generated by typings
  2. // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/912bbfc/jquery.dataTables/jquery.dataTables.d.ts
  3. interface JQuery {
  4. DataTable(param?: DataTables.Settings): DataTables.DataTable;
  5. }
  6. //TODO: Wrong, as jquery.d.ts has no interface for fn
  7. //interface JQueryStatic {
  8. // dataTable: DataTables.StaticFunctions;
  9. //}
  10. declare namespace DataTables {
  11. export interface DataTable extends DataTableCore {
  12. /**
  13. * Get the data for the whole table.
  14. */
  15. data(): DataTable;
  16. /**
  17. * Order Methods / Object
  18. */
  19. order: OrderMethods;
  20. //#region "Cell/Cells"
  21. /**
  22. * Select the cell found by a cell selector
  23. *
  24. * @param cellSelector Cell selector.
  25. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  26. */
  27. cell(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods;
  28. /**
  29. * Select the cell found by a cell selector
  30. *
  31. * @param rowSelector Row selector.
  32. * @param cellSelector Cell selector.
  33. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  34. */
  35. cell(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellMethods;
  36. /**
  37. * Select all cells
  38. *
  39. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  40. */
  41. cells(modifier?: ObjectSelectorModifier): CellsMethods;
  42. /**
  43. * Select cells found by a cell selector
  44. *
  45. * @param cellSelector Cell selector.
  46. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  47. */
  48. cells(cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods;
  49. /**
  50. * Select cells found by both row and column selectors
  51. *
  52. * @param rowSelector Row selector.
  53. * @param cellSelector Cell selector.
  54. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  55. */
  56. cells(rowSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], cellSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[], modifier?: ObjectSelectorModifier): CellsMethods;
  57. //#endregion "Cell/Cells"
  58. //#region "Column/Columns"
  59. /**
  60. * Column Methods / Object
  61. */
  62. column: ColumnMethodsModel;
  63. /**
  64. * Columns Methods / Object
  65. */
  66. columns: ColumnsMethodsModel;
  67. //#endregion "Column/Columns"
  68. //#region "Row/Rows"
  69. /**
  70. * Row Methode / Object
  71. */
  72. row: RowMethodsModel
  73. /**
  74. * Rows Methods / Object
  75. */
  76. rows: RowsMethodsModel
  77. //#endregion "Row/Rows"
  78. //#region "Table/Tables"
  79. /**
  80. * Select a table based on a selector from the API's context
  81. *
  82. * @param tableSelector Table selector.
  83. */
  84. table(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TableMethods;
  85. /**
  86. * Select all tables
  87. */
  88. tables(): TablesMethods;
  89. /**
  90. * Select tables based on the given selector
  91. *
  92. * @param tableSelector Table selector.
  93. */
  94. tables(tableSelector: (string | Node | Function | JQuery | Object) | (string | Node | Function | JQuery | Object)[]): TablesMethods;
  95. //#endregion "Table/Tables"
  96. }
  97. export interface DataTables extends DataTableCore {
  98. [index: number]: DataTable;
  99. }
  100. interface ObjectSelectorModifier {
  101. /**
  102. * The order modifier provides the ability to control which order the rows are processed in.
  103. * Values: 'current', 'applied', 'index', 'original'
  104. */
  105. order?: string;
  106. /**
  107. * 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.
  108. * Values: 'none', 'applied', 'removed'
  109. */
  110. search?: string;
  111. /**
  112. * 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.
  113. * Values: 'all', 'current'
  114. */
  115. page?: string;
  116. }
  117. //#region "Namespaces"
  118. //#region "core-methods"
  119. interface DataTableCore extends UtilityMethods {
  120. /**
  121. * Get jquery object
  122. */
  123. $(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery;
  124. ///// Almost identical to $ in operation, but in this case returns the data for the matched rows.
  125. //_(selector: string | Node | Node[] | JQuery, modifier?: ObjectSelectorModifier): JQuery;
  126. /**
  127. * Ajax Methods
  128. */
  129. ajax: AjaxMethodModel;
  130. /**
  131. * Clear the table of all data.
  132. */
  133. clear(): DataTable;
  134. /**
  135. * Destroy the DataTables in the current context.
  136. *
  137. * @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).
  138. */
  139. destroy(remove?: boolean): DataTable;
  140. /**
  141. * Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required.
  142. *
  143. * @param paging This parameter is used to determine what kind of draw DataTables will perform.
  144. */
  145. draw(paging?: boolean | string): DataTable;
  146. /*
  147. * Look up a language token that was defined in the DataTables' language initialisation object.
  148. *
  149. * @param token The language token to lookup from the language object.
  150. * @param def The default value to use if the DataTables initialisation has not specified a value.
  151. * @param numeric If handling numeric output, the number to be presented should be given in this parameter. If not numeric operator is required (for example button label text) this parameter is not required.
  152. *
  153. * @returns Resulting internationalised string.
  154. */
  155. i18n(token: string, def: any | string, numeric?: number): string;
  156. /*
  157. * Get the initialisation options used for the table. Since: DataTables 1.10.6
  158. */
  159. init(): Settings;
  160. /**
  161. * Table events removal.
  162. *
  163. * @param event Event name to remove.
  164. * @param callback Specific callback function to remove if you want to unbind a single event listener.
  165. */
  166. off(event: string, callback?: Function): DataTable;
  167. /**
  168. * Table events listener.
  169. *
  170. * @param event Event to listen for.
  171. * @param callback Specific callback function to remove if you want to unbind a single event listener.
  172. */
  173. on(event: string, callback: Function): DataTable;
  174. /**
  175. * Listen for a table event once and then remove the listener.
  176. *
  177. * @param event Event to listen for.
  178. * @param callback Specific callback function to remove if you want to unbind a single event listener.
  179. */
  180. one(event: string, callback: Function): DataTable;
  181. /**
  182. * Page Methods / Object
  183. */
  184. page: PageMethods;
  185. /**
  186. * Get current search
  187. */
  188. search(): string;
  189. /**
  190. * Search for data in the table.
  191. *
  192. * @param input Search string to apply to the table.
  193. * @param regex Treat as a regular expression (true) or not (default, false).
  194. * @param smart Perform smart search.
  195. * @param caseInsen Do case-insensitive matching (default, true) or not (false).
  196. */
  197. search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): DataTable;
  198. /**
  199. * Obtain the table's settings object
  200. */
  201. settings(): DataTable;
  202. /**
  203. * Page Methods / Object
  204. */
  205. state: StateMethods;
  206. }
  207. //#region "ajax-methods"
  208. interface AjaxMethods extends DataTable {
  209. /**
  210. * Reload the table data from the Ajax data source.
  211. *
  212. * @param callback Function which is executed when the data as been reloaded and the table fully redrawn.
  213. * @param resetPaging Reset (default action or true) or hold the current paging position (false).
  214. */
  215. load(callback?: Function, resetPaging?: boolean): DataTable;
  216. }
  217. interface AjaxMethodModel {
  218. /**
  219. * Get the latest JSON data obtained from the last Ajax request DataTables made
  220. */
  221. json(): Object;
  222. /**
  223. * Get the data submitted by DataTables to the server in the last Ajax request
  224. */
  225. params(): Object;
  226. /**
  227. * Reload the table data from the Ajax data source.
  228. *
  229. * @param callback Function which is executed when the data as been reloaded and the table fully redrawn.
  230. * @param resetPaging Reset (default action or true) or hold the current paging position (false).
  231. */
  232. reload(callback?: Function, resetPaging?: boolean): DataTable;
  233. /**
  234. * Reload the table data from the Ajax data source
  235. */
  236. url(): string;
  237. /**
  238. * Reload the table data from the Ajax data source
  239. *
  240. * @param url URL to set to be the Ajax data source for the table.
  241. */
  242. url(url: string): AjaxMethods;
  243. }
  244. //#endregion "ajax-methods"
  245. //#region "order-methods"
  246. interface OrderMethods {
  247. /**
  248. * Get the ordering applied to the table.
  249. */
  250. (): (string | number)[][];
  251. /**
  252. * Set the ordering applied to the table.
  253. *
  254. * @param order Order Model
  255. */
  256. (order?: (string | number)[]): DataTable;
  257. (order?: (string | number)[][]): DataTable;
  258. (order: (string | number)[], ...args: any[]): DataTable;
  259. /**
  260. * Add an ordering listener to an element, for a given column.
  261. *
  262. * @param node Selector
  263. * @param column Column index
  264. * @param callback Callback function
  265. */
  266. listener(node: string | Node | JQuery, column: number, callback: Function): DataTable;
  267. }
  268. //#endregion "order-methods"
  269. //#region "page-methods"
  270. interface PageMethods {
  271. /**
  272. * Get the current page of the table.
  273. */
  274. (): number;
  275. /**
  276. * Set the current page of the table.
  277. *
  278. * @param page Index or 'first', 'next', 'previous', 'last'
  279. */
  280. (page: number | string): DataTable;
  281. /**
  282. * Get paging information about the table
  283. */
  284. info(): PageMethodeModelInfoReturn;
  285. /**
  286. * Get the table's page length.
  287. */
  288. len(): number;
  289. /**
  290. * Set the table's page length.
  291. *
  292. * @param length Page length to set. use -1 to show all records.
  293. */
  294. len(length: number): DataTable;
  295. }
  296. interface PageMethodeModelInfoReturn {
  297. page: number;
  298. pages: number;
  299. start: number;
  300. end: number;
  301. length: number;
  302. recordsTotal: number;
  303. recordsDisplay: number;
  304. serverSide: boolean
  305. }
  306. //#endregion "page-methods"
  307. //#region "state-methods"
  308. interface StateMethods {
  309. /**
  310. * Get the last saved state of the table
  311. */
  312. (): StateReturnModel;
  313. /**
  314. * Clear the saved state of the table.
  315. */
  316. clear(): DataTable;
  317. /**
  318. * Get the table state that was loaded during initialisation.
  319. */
  320. loaded(): StateReturnModel;
  321. /**
  322. * Trigger a state save.
  323. */
  324. save(): DataTable;
  325. }
  326. interface StateReturnModel {
  327. time: number;
  328. start: number;
  329. length: number;
  330. order: (string | number)[][];
  331. search: SearchSettings;
  332. columns: StateReturnModelColumns[];
  333. }
  334. interface StateReturnModelColumns {
  335. search: SearchSettings;
  336. visible: boolean;
  337. }
  338. //#endregion "state-methods"
  339. //#endregion "core-methods"
  340. //#region "util-methods"
  341. interface UtilityMethods {
  342. /*
  343. * 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).
  344. */
  345. any(): boolean;
  346. /**
  347. * Concatenate two or more API instances together
  348. *
  349. * @param a API instance to concatenate to the initial instance.
  350. * @param b Additional API instance(s) to concatenate to the initial instance.
  351. */
  352. concat(a: Object, ...b: Object[]): DataTable;
  353. /**
  354. * 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
  355. */
  356. count(): number;
  357. /**
  358. * Iterate over the contents of the API result set.
  359. *
  360. * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters
  361. */
  362. each(fn: Function): DataTable;
  363. /**
  364. * Reduce an Api instance to a single context and result set.
  365. *
  366. * @param idx Index to select
  367. */
  368. eq(idx: number): DataTable;
  369. /**
  370. * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass.
  371. *
  372. * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters.
  373. */
  374. filter(fn: Function): DataTable;
  375. /**
  376. * Flatten a 2D array structured API instance to a 1D array structure.
  377. */
  378. flatten(): DataTable;
  379. /**
  380. * Find the first instance of a value in the API instance's result set.
  381. *
  382. * @param value Value to find in the instance's result set.
  383. */
  384. indexOf(value: any): number;
  385. /**
  386. * Join the elements in the result set into a string.
  387. *
  388. * @param separator The string that will be used to separate each element of the result set.
  389. */
  390. join(separator: string): string;
  391. /**
  392. * Find the last instance of a value in the API instance's result set.
  393. *
  394. * @param value Value to find in the instance's result set.
  395. */
  396. lastIndexOf(value: any): number;
  397. /**
  398. * Number of elements in an API instance's result set.
  399. */
  400. length: number;
  401. /**
  402. * Iterate over the result set of an API instance, creating a new API instance from the values returned by the callback.
  403. *
  404. * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters.
  405. */
  406. map(fn: Function): DataTable;
  407. /**
  408. * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements.
  409. *
  410. * @param property Object property name to use from the element in the original result set for the new result set.
  411. */
  412. pluck(property: number | string): DataTable;
  413. /**
  414. * Remove the last item from an API instance's result set.
  415. */
  416. pop(): any;
  417. /**
  418. * Add one or more items to the end of an API instance's result set.
  419. *
  420. * @param value_1 Item to add to the API instance's result set.
  421. */
  422. push(value_1: any | any[], ...value_2: any[]): number;
  423. /**
  424. * Apply a callback function against and accumulator and each element in the Api's result set (left-to-right).
  425. *
  426. * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters.
  427. * @param initialValue Value to use as the first argument of the first call to the fn callback.
  428. */
  429. reduce(fn: Function, initialValue?: any): any;
  430. /**
  431. * Apply a callback function against and accumulator and each element in the Api's result set (right-to-left).
  432. *
  433. * @param fn Callback function which is called for each item in the API instance result set. The callback is called with four parameters.
  434. * @param initialValue Value to use as the first argument of the first call to the fn callback.
  435. */
  436. reduceRight(fn: Function, initialValue?: any): any;
  437. /**
  438. * Reverse the result set of the API instance and return the original array.
  439. */
  440. reverse(): DataTable;
  441. /**
  442. * Remove the first item from an API instance's result set.
  443. */
  444. shift(): any;
  445. /**
  446. * Sort the elements of the API instance's result set.
  447. *
  448. * @param fn This is a standard Javascript sort comparison function. It accepts two parameters.
  449. */
  450. sort(fn?: Function): DataTable;
  451. /**
  452. * Modify the contents of an Api instance's result set, adding or removing items from it as required.
  453. *
  454. * @param index Index at which to start modifying the Api instance's result set.
  455. * @param howMany Number of elements to remove from the result set.
  456. * @param value_1 Item to add to the result set at the index specified by the first parameter.
  457. */
  458. splice(index: number, howMany: number, value_1?: any | any[], ...value_2: any[]): any[];
  459. /**
  460. * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set.
  461. */
  462. to$(): JQuery;
  463. /**
  464. * Create a native Javascript array object from an API instance.
  465. */
  466. toArray(): any[];
  467. /**
  468. * Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set.
  469. */
  470. toJQuery(): JQuery;
  471. /**
  472. * Create a new API instance containing only the unique items from a the elements in an instance's result set.
  473. */
  474. unique(): DataTable;
  475. /**
  476. * Add one or more items to the start of an API instance's result set.
  477. *
  478. * @param value_1 Item to add to the API instance's result set.
  479. */
  480. unshift(value_1: any | any[], ...value_2: any[]): number;
  481. }
  482. //#endregion "util-methods"
  483. interface CommonSubMethods {
  484. /**
  485. * Get the DataTables cached data for the selected cell
  486. *
  487. * @param t Specify which cache the data should be read from. Can take one of two values: search or order
  488. */
  489. cache(t: string): DataTable;
  490. }
  491. //#region "cell-methods"
  492. interface CommonCellMethods extends CommonSubMethods {
  493. /**
  494. * Invalidate the data held in DataTables for the selected cells
  495. *
  496. * @param source Data source to read the new data from.
  497. */
  498. invalidate(source?: string): DataTable;
  499. /**
  500. * Get data for the selected cell
  501. *
  502. * @param f Data type to get. This can be one of: 'display', 'filter', 'sort', 'type'
  503. */
  504. render(t: string): any;
  505. }
  506. interface CellMethods extends DataTableCore, CommonCellMethods {
  507. /**
  508. * Get data for the selected cell
  509. */
  510. data(): any;
  511. /**
  512. * Get data for the selected cell
  513. *
  514. * @param data Value to assign to the data for the cell
  515. */
  516. data(data: any): DataTable;
  517. /**
  518. * Get index information about the selected cell
  519. */
  520. index(): CellIndexReturn;
  521. /**
  522. * Get the DOM element for the selected cell
  523. */
  524. node(): Node;
  525. }
  526. interface CellIndexReturn {
  527. row: number;
  528. column: number;
  529. columnVisible: number;
  530. }
  531. interface CellsMethods extends DataTableCore, CommonCellMethods {
  532. /**
  533. * Get data for the selected cells
  534. */
  535. data(): DataTable;
  536. /**
  537. * Iterate over each selected cell, with the function context set to be the cell in question. Since: DataTables 1.10.6
  538. *
  539. * @param fn Function to execute for every cell selected.
  540. */
  541. every(fn: (cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): DataTable;
  542. /**
  543. * Get index information about the selected cells
  544. */
  545. indexes(): DataTable;
  546. /**
  547. * Get the DOM elements for the selected cells
  548. */
  549. nodes(): DataTable;
  550. }
  551. //#endregion "cell-methods"
  552. //#region "column-methods"
  553. interface CommonColumnMethod extends CommonSubMethods {
  554. /**
  555. * Get the footer th / td cell for the selected column.
  556. */
  557. footer(): any;
  558. /**
  559. * Get the header th / td cell for a column.
  560. */
  561. header(): Node;
  562. /**
  563. * Order the table, in the direction specified, by the column selected by the column()DT selector.
  564. *
  565. * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending).
  566. */
  567. order(direction: string): DataTable;
  568. /**
  569. * Get the visibility of the selected column.
  570. */
  571. visible(): boolean;
  572. /**
  573. * Set the visibility of the selected column.
  574. *
  575. * @param show Specify if the column should be visible (true) or not (false).
  576. * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance.
  577. */
  578. visible(show: boolean, redrawCalculations?: boolean): DataTable;
  579. }
  580. interface ColumnMethodsModel {
  581. /**
  582. * Select the column found by a column selector
  583. *
  584. * @param cellSelector Cell selector.
  585. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  586. */
  587. (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnMethods;
  588. /**
  589. * Convert from the input column index type to that required.
  590. *
  591. * @param t The type on conversion that should take place: 'fromVisible', 'toData', 'fromData', 'toVisible'
  592. * @param index The index to be converted
  593. */
  594. index(t: string, index: number): number;
  595. }
  596. interface ColumnMethods extends DataTableCore, CommonColumnMethod {
  597. /**
  598. * Get the data for the cells in the selected column.
  599. */
  600. data(): DataTable;
  601. /**
  602. * Get the data source property for the selected column
  603. */
  604. dataSrc(): number | string | Function;
  605. /**
  606. * Get index information about the selected cell
  607. *
  608. * @param t Specify if you want to get the column data index (default) or the visible index (visible).
  609. */
  610. index(t?: string): DataTable;
  611. /**
  612. * Obtain the th / td nodes for the selected column
  613. */
  614. nodes(): DataTable[];
  615. }
  616. interface ColumnsMethodsModel {
  617. /**
  618. * Select all columns
  619. *
  620. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  621. */
  622. (modifier?: ObjectSelectorModifier): ColumnsMethods;
  623. /**
  624. * Select columns found by a cell selector
  625. *
  626. * @param cellSelector Cell selector.
  627. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  628. */
  629. (columnSelector: any, modifier?: ObjectSelectorModifier): ColumnsMethods;
  630. /**
  631. * Recalculate the column widths for layout.
  632. */
  633. adjust(): DataTable;
  634. }
  635. interface ColumnsMethods extends DataTableCore, CommonColumnMethod {
  636. /**
  637. * Obtain the data for the columns from the selector
  638. */
  639. data(): DataTable;
  640. /**
  641. * Get the data source property for the selected columns.
  642. */
  643. dataSrc(): DataTable;
  644. /**
  645. * Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6
  646. *
  647. * @param fn Function to execute for every column selected.
  648. */
  649. every(fn: (colIdx: number, tableLoop: number, colLoop: number) => void): DataTable;
  650. /**
  651. * Get the column indexes of the selected columns.
  652. *
  653. * @param t Specify if you want to get the column data index (default) or the visible index (visible).
  654. */
  655. indexes(t?: string): DataTable;
  656. /**
  657. * Obtain the th / td nodes for the selected columns
  658. */
  659. nodes(): DataTable[][];
  660. }
  661. //#endregion "column-methods"
  662. //#region "row-methods"
  663. interface CommonRowMethod extends CommonSubMethods {
  664. /**
  665. * Obtain the th / td nodes for the selected column
  666. *
  667. * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom'
  668. */
  669. invalidate(source?: string): DataTable;
  670. }
  671. interface RowChildMethodModel {
  672. /**
  673. * Get the child row(s) that have been set for a parent row
  674. */
  675. (): JQuery;
  676. /**
  677. * Get the child row(s) that have been set for a parent row
  678. *
  679. * @param showRemove This parameter can be given as true or false
  680. */
  681. (showRemove: boolean): RowChildMethods;
  682. /**
  683. * 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.
  684. *
  685. * @param data The data to be shown in the child row can be given in multiple different ways.
  686. * @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).
  687. */
  688. (data: (string | Node | JQuery) | (string | Node | JQuery)[], className?: string): RowChildMethods;
  689. /**
  690. * Hide the child row(s) of a parent row
  691. */
  692. hide(): DataTable;
  693. /**
  694. * Check if the child rows of a parent row are visible
  695. */
  696. isShown(): DataTable;
  697. /**
  698. * Remove child row(s) from display and release any allocated memory
  699. */
  700. remove(): DataTable;
  701. /**
  702. * Show the child row(s) of a parent row
  703. */
  704. show(): DataTable;
  705. }
  706. interface RowChildMethods extends DataTableCore {
  707. /**
  708. * Hide the child row(s) of a parent row
  709. */
  710. hide(): DataTable;
  711. /**
  712. * Remove child row(s) from display and release any allocated memory
  713. */
  714. remove(): DataTable;
  715. /**
  716. * Make newly defined child rows visible
  717. */
  718. show(): DataTable;
  719. }
  720. interface RowMethodsModel {
  721. /**
  722. * Select a row found by a row selector
  723. *
  724. * @param rowSelector Row selector.
  725. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  726. */
  727. (rowSelector: any, modifier?: ObjectSelectorModifier): RowMethods;
  728. /**
  729. * Add a new row to the table using the given data
  730. *
  731. * @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
  732. */
  733. add(data: any[] | Object): DataTable;
  734. }
  735. interface RowMethods extends DataTableCore, CommonRowMethod {
  736. /**
  737. * Order Methods / Object
  738. */
  739. child: RowChildMethodModel;
  740. /**
  741. * Get the data for the selected row
  742. */
  743. data(): any[] | Object;
  744. /**
  745. * Set the data for the selected row
  746. *
  747. * @param d Data to use for the row.
  748. */
  749. data(d: any[] | Object): DataTable;
  750. /**
  751. * Get the id of the selected row.
  752. *
  753. * @param hash Set to true to append a hash (#) to the start of the row id.
  754. */
  755. id(hash?: boolean): string;
  756. /**
  757. * Get the id of the selected row. Since: 1.10.8
  758. *
  759. * @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
  760. * false - Do not modify the id value.
  761. * @returns Row id. If the row does not have an id available 'undefined' will be returned.
  762. */
  763. id(hash?: boolean): string;
  764. /**
  765. * Get the row index of the row column.
  766. */
  767. index(): number;
  768. /**
  769. * Obtain the tr node for the selected row
  770. */
  771. node(): Node;
  772. /**
  773. * Delete the selected row from the DataTable.
  774. */
  775. remove(): Node;
  776. }
  777. interface RowsMethodsModel {
  778. /**
  779. * Select all rows
  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): RowsMethods;
  784. /**
  785. * Select rows found by a row selector
  786. *
  787. * @param cellSelector Row selector.
  788. * @param Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account.
  789. */
  790. (rowSelector: any, modifier?: ObjectSelectorModifier): RowsMethods;
  791. /**
  792. * Add new rows to the table using the data given
  793. *
  794. * @param data Array of data elements, with each one describing a new row to be added to the table
  795. */
  796. add(data: any[]): DataTable;
  797. }
  798. interface RowsMethods extends DataTableCore, CommonRowMethod {
  799. /**
  800. * Get the data for the rows from the selector
  801. */
  802. data(): DataTable;
  803. /**
  804. * Set the data for the selected row
  805. *
  806. * @param d Data to use for the row.
  807. */
  808. data(d: any[] | Object): DataTable;
  809. /**
  810. * Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6
  811. *
  812. * @param fn Function to execute for every row selected.
  813. */
  814. every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): DataTable;
  815. /**
  816. * Get the ids of the selected rows. Since: 1.10.8
  817. *
  818. * @param hash true - Append a hash (#) to the start of each row id. This can be useful for then using the ids as selectors
  819. * false - Do not modify the id value.
  820. * @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.
  821. */
  822. ids(hash?: boolean): DataTable;
  823. /**
  824. * Get the row indexes of the selected rows.
  825. */
  826. indexes(): DataTable;
  827. /**
  828. * Obtain the tr nodes for the selected rows
  829. */
  830. nodes(): DataTable;
  831. /**
  832. * Delete the selected rows from the DataTable.
  833. */
  834. remove(): DataTable;
  835. }
  836. //#endregion "row-methods"
  837. //#region "table-methods"
  838. interface TableMethods extends DataTableCore {
  839. /**
  840. * Get the tfoot node for the table in the API's context
  841. */
  842. footer(): Node;
  843. /**
  844. * Get the thead node for the table in the API's context
  845. */
  846. header(): Node;
  847. /**
  848. * Get the tbody node for the table in the API's context
  849. */
  850. body(): Node;
  851. /**
  852. * Get the div container node for the table in the API's context
  853. */
  854. container(): Node;
  855. /**
  856. * Get the table node for the table in the API's context
  857. */
  858. node(): Node;
  859. }
  860. interface TablesMethods extends DataTableCore {
  861. /**
  862. * Get the tfoot nodes for the tables in the API's context
  863. */
  864. footer(): DataTable;
  865. /**
  866. * Get the thead nodes for the tables in the API's context
  867. */
  868. header(): DataTable;
  869. /**
  870. * Get the tbody nodes for the tables in the API's context
  871. */
  872. body(): DataTable;
  873. /**
  874. * Get the div container nodes for the tables in the API's context
  875. */
  876. containers(): DataTable;
  877. /**
  878. * Get the table nodes for the tables in the API's context
  879. */
  880. nodes(): DataTable;
  881. }
  882. //#endregion "table-methods"
  883. //#endregion "Namespaces"
  884. //#region "Static-Methods"
  885. export interface StaticFunctions {
  886. /**
  887. * Check is a table node is a DataTable or not
  888. *
  889. * @param table Selector string for table
  890. */
  891. isDataTable(table: string): boolean;
  892. /**
  893. * 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.
  894. *
  895. * @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).
  896. * Since 1.10.8 this option can also be given as an object.
  897. */
  898. tables(visible?: boolean | ObjectTablesStatic): DataTables.DataTable[] | DataTables.DataTable;
  899. /**
  900. * Version number compatibility check function
  901. *
  902. * @param version Version string
  903. */
  904. versionCheck(version: string): boolean;
  905. /**
  906. * Utils
  907. */
  908. util: StaticUtilFunctions;
  909. /**
  910. * Check is a table node is a DataTable or not
  911. *
  912. * @param table Selector string for table
  913. */
  914. Api(selector: string | Node | Node[] | JQuery): DataTables.DataTable;
  915. }
  916. export interface StaticUtilFunctions {
  917. /**
  918. * Escape special characters in a regular expression string. Since: 1.10.4
  919. *
  920. * @param str String to escape
  921. */
  922. escapeRegex(str: string): string;
  923. /**
  924. * Throttle the calls to a method to reduce call frequency. Since: 1.10.3
  925. *
  926. * @param fn Function
  927. * @param period ms
  928. */
  929. throttle(fn: Function, period?: number): Function;
  930. }
  931. interface ObjectTablesStatic {
  932. /**
  933. * Get only visible tables (true) or all tables regardless of visibility (false).
  934. */
  935. visible: boolean
  936. /**
  937. * Return a DataTables API instance for the selected tables (true) or an array (false).
  938. */
  939. api: boolean
  940. }
  941. //#endregion "Static-Methods"
  942. //#region "Settings"
  943. export interface Settings {
  944. //#region "Features"
  945. /**
  946. * Feature control DataTables' smart column width handling. Since: 1.10
  947. */
  948. autoWidth?: boolean;
  949. /**
  950. * Feature control deferred rendering for additional speed of initialisation. Since: 1.10
  951. */
  952. deferRender?: boolean;
  953. /**
  954. * Feature control table information display field. Since: 1.10
  955. */
  956. info?: boolean;
  957. /**
  958. * Use markup and classes for the table to be themed by jQuery UI ThemeRoller. Since: 1.10
  959. */
  960. jQueryUI?: boolean;
  961. /**
  962. * Feature control the end user's ability to change the paging display length of the table. Since: 1.10
  963. */
  964. lengthChange?: boolean;
  965. /**
  966. * Feature control ordering (sorting) abilities in DataTables. Since: 1.10
  967. */
  968. ordering?: boolean;
  969. /**
  970. * Enable or disable table pagination. Since: 1.10
  971. */
  972. paging?: boolean;
  973. /**
  974. * Feature control the processing indicator. Since: 1.10
  975. */
  976. processing?: boolean;
  977. /**
  978. * Horizontal scrolling. Since: 1.10
  979. */
  980. scrollX?: boolean;
  981. /**
  982. * Vertical scrolling. Since: 1.10 Exp: "200px"
  983. */
  984. scrollY?: string;
  985. /**
  986. * Feature control search (filtering) abilities Since: 1.10
  987. */
  988. searching?: boolean;
  989. /**
  990. * Feature control DataTables' server-side processing mode. Since: 1.10
  991. */
  992. serverSide?: boolean;
  993. /**
  994. * State saving - restore table state on page reload. Since: 1.10
  995. */
  996. stateSave?: boolean;
  997. //#endregion "Features"
  998. //#region "Data"
  999. /**
  1000. * Load data for the table's content from an Ajax source. Since: 1.10
  1001. */
  1002. ajax?: string | AjaxSettings | FunctionAjax;
  1003. /**
  1004. * Data to use as the display data for the table. Since: 1.10
  1005. */
  1006. data?: Object;
  1007. //#endregion "Data"
  1008. //#region "Options"
  1009. /**
  1010. * Data to use as the display data for the table. Since: 1.10
  1011. */
  1012. columns?: ColumnSettings[];
  1013. /**
  1014. * Assign a column definition to one or more columns.. Since: 1.10
  1015. */
  1016. columnDefs?: ColumnDefsSettings[];
  1017. /**
  1018. * Delay the loading of server-side data until second draw
  1019. */
  1020. deferLoading?: number | number[];
  1021. /**
  1022. * Destroy any existing table matching the selector and replace with the new options. Since: 1.10
  1023. */
  1024. destroy?: boolean;
  1025. /**
  1026. * Initial paging start point. Since: 1.10
  1027. */
  1028. displayStart?: number;
  1029. /**
  1030. * Define the table control elements to appear on the page and in what order. Since: 1.10
  1031. */
  1032. dom?: string;
  1033. /**
  1034. * Change the options in the page length select list. Since: 1.10
  1035. */
  1036. lengthMenu?: (number | string)[] | (number | string)[][];
  1037. /**
  1038. * Control which cell the order event handler will be applied to in a column. Since: 1.10
  1039. */
  1040. orderCellsTop?: boolean;
  1041. /**
  1042. * Highlight the columns being ordered in the table's body. Since: 1.10
  1043. */
  1044. orderClasses?: boolean;
  1045. /**
  1046. * Initial order (sort) to apply to the table. Since: 1.10
  1047. */
  1048. order?: (string | number)[] | (string | number)[][];
  1049. /**
  1050. * Ordering to always be applied to the table. Since: 1.10
  1051. */
  1052. orderFixed?: (string | number)[] | (string | number)[][] | Object;
  1053. /**
  1054. * Multiple column ordering ability control. Since: 1.10
  1055. */
  1056. orderMulti?: boolean;
  1057. /**
  1058. * Change the initial page length (number of rows per page). Since: 1.10
  1059. */
  1060. pageLength?: number;
  1061. /**
  1062. * Pagination button display options. Basic Types: numbers (1.10.8) simple, simple_numbers, full, full_numbers
  1063. */
  1064. pagingType?: string;
  1065. /**
  1066. * Retrieve an existing DataTables instance. Since: 1.10
  1067. */
  1068. retrieve?: boolean
  1069. /**
  1070. * Display component renderer types. Since: 1.10
  1071. */
  1072. renderer?: string | RendererSettings;
  1073. /**
  1074. * Data property name that DataTables will use to set <tr> element DOM IDs. Since: 1.10.8
  1075. */
  1076. rowId?: string;
  1077. /**
  1078. * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10
  1079. */
  1080. scrollCollapse?: boolean;
  1081. /**
  1082. * Set an initial filter in DataTables and / or filtering options. Since: 1.10
  1083. */
  1084. search?: SearchSettings;
  1085. /**
  1086. * Define an initial search for individual columns. Since: 1.10
  1087. */
  1088. searchCols?: SearchSettings[];
  1089. /**
  1090. * Set a throttle frequency for searching. Since: 1.10
  1091. */
  1092. searchDelay?: number;
  1093. /**
  1094. * Saved state validity duration. Since: 1.10
  1095. */
  1096. stateDuration?: number;
  1097. /**
  1098. * Set the zebra stripe class names for the rows in the table. Since: 1.10
  1099. */
  1100. stripeClasses?: string[];
  1101. /**
  1102. * Tab index control for keyboard navigation. Since: 1.10
  1103. */
  1104. tabIndex?: number;
  1105. //#endregion "Options"
  1106. //#region "Callbacks"
  1107. /**
  1108. * Callback for whenever a TR element is created for the table's body. Since: 1.10
  1109. */
  1110. createdRow?: FunctionCreateRow;
  1111. /**
  1112. * Function that is called every time DataTables performs a draw. Since: 1.10
  1113. */
  1114. drawCallback?: FunctionDrawCallback;
  1115. /**
  1116. * Footer display callback function. Since: 1.10
  1117. */
  1118. footerCallback?: FunctionFooterCallback;
  1119. /**
  1120. * Number formatting callback function. Since: 1.10
  1121. */
  1122. formatNumber?: FunctionFormatNumber;
  1123. /**
  1124. * Header display callback function. Since: 1.10
  1125. */
  1126. headerCallback?: FunctionHeaderCallback;
  1127. /**
  1128. * Table summary information display callback. Since: 1.10
  1129. */
  1130. infoCallback?: FunctionInfoCallback;
  1131. /**
  1132. * Initialisation complete callback. Since: 1.10
  1133. */
  1134. initComplete?: FunctionInitComplete;
  1135. /**
  1136. * Pre-draw callback. Since: 1.10
  1137. */
  1138. preDrawCallback?: FunctionPreDrawCallback;
  1139. /**
  1140. * Row draw callback.. Since: 1.10
  1141. */
  1142. rowCallback?: FunctionRowCallback;
  1143. /**
  1144. * Callback that defines where and how a saved state should be loaded. Since: 1.10
  1145. */
  1146. stateLoadCallback?: FunctionStateLoadCallback;
  1147. /**
  1148. * State loaded callback. Since: 1.10
  1149. */
  1150. stateLoaded?: FunctionStateLoaded;
  1151. /**
  1152. * State loaded - data manipulation callback. Since: 1.10
  1153. */
  1154. stateLoadParams?: FunctionStateLoadParams;
  1155. /**
  1156. * Callback that defines how the table state is stored and where. Since: 1.10
  1157. */
  1158. stateSaveCallback?: FunctionStateSaveCallback;
  1159. /**
  1160. * State save - data manipulation callback. Since: 1.10
  1161. */
  1162. stateSaveParams?: FunctionStateSaveParams;
  1163. //#endregion "Callbacks"
  1164. //#region "Language"
  1165. language?: LanguageSettings;
  1166. //#endregion "Language"
  1167. }
  1168. //#region "ajax-settings"
  1169. export interface AjaxDataRequest {
  1170. draw: number;
  1171. start: number;
  1172. length: number;
  1173. data: any;
  1174. order: AjaxDataRequestOrder[];
  1175. columns: AjaxDataRequestColumn[];
  1176. search: AjaxDataRequestSearch;
  1177. }
  1178. export interface AjaxDataRequestSearch {
  1179. value: string;
  1180. regex: boolean;
  1181. }
  1182. export interface AjaxDataRequestOrder {
  1183. column: number;
  1184. dir: string;
  1185. }
  1186. export interface AjaxDataRequestColumn {
  1187. data: string | number;
  1188. name: string;
  1189. searchable: boolean;
  1190. orderable: boolean;
  1191. search: AjaxDataRequestSearch;
  1192. }
  1193. export interface AjaxData {
  1194. draw: number;
  1195. recordsTotal: number;
  1196. recordsFiltered: number;
  1197. data: any;
  1198. error?: string;
  1199. }
  1200. interface AjaxSettings extends JQueryAjaxSettings {
  1201. /**
  1202. * Add or modify data submitted to the server upon an Ajax request. Since: 1.10
  1203. */
  1204. data?: Object | FunctionAjaxData;
  1205. /**
  1206. * Data property or manipulation method for table data. Since: 1.10
  1207. */
  1208. dataSrc?: string | Function;
  1209. }
  1210. interface FunctionAjax {
  1211. (data: Object, callback: Function, settings: SettingsLegacy): void;
  1212. }
  1213. interface FunctionAjaxData {
  1214. /*
  1215. * @param data Data that DataTables has constructed for the request.
  1216. * @param settings DataTables settings object. Since 1.10.6
  1217. */
  1218. (data: Object, settings: Settings): string | Object;
  1219. }
  1220. //#endregion "ajax-settings"
  1221. //#region "colunm-settings"
  1222. export interface ColumnSettings {
  1223. /**
  1224. * Cell type to be created for a column. th/td Since: 1.10
  1225. */
  1226. cellType?: string;
  1227. /**
  1228. * Class to assign to each cell in the column. Since: 1.10
  1229. */
  1230. className?: string;
  1231. /**
  1232. * Add padding to the text content used when calculating the optimal with for a table. Since: 1.10
  1233. */
  1234. contentPadding?: string;
  1235. /**
  1236. * Cell created callback to allow DOM manipulation. Since: 1.10
  1237. */
  1238. createdCell?: FunctionColumnCreatedCell;
  1239. /**
  1240. * Class to assign to each cell in the column. Since: 1.10
  1241. */
  1242. data?: number | string | ObjectColumnData | FunctionColumnData;
  1243. /**
  1244. * Set default, static, content for a column. Since: 1.10
  1245. */
  1246. defaultContent?: string;
  1247. /**
  1248. * Set a descriptive name for a column. Since: 1.10
  1249. */
  1250. name?: string;
  1251. /**
  1252. * Enable or disable ordering on this column. Since: 1.10
  1253. */
  1254. orderable?: boolean;
  1255. /**
  1256. * Define multiple column ordering as the default order for a column. Since: 1.10
  1257. */
  1258. orderData?: number | number[];
  1259. /**
  1260. * Live DOM sorting type assignment. Since: 1.10
  1261. */
  1262. orderDataType?: string;
  1263. /**
  1264. * Order direction application sequence. Since: 1.10
  1265. */
  1266. orderSequence?: string[];
  1267. /**
  1268. * Render (process) the data for use in the table. Since: 1.10
  1269. */
  1270. render?: number | string | ObjectColumnRender | FunctionColumnRender;
  1271. /**
  1272. * Enable or disable filtering on the data in this column. Since: 1.10
  1273. */
  1274. searchable?: boolean;
  1275. /**
  1276. * Set the column title. Since: 1.10
  1277. */
  1278. title?: string;
  1279. /**
  1280. * Set the column type - used for filtering and sorting string processing. Since: 1.10
  1281. */
  1282. type?: string;
  1283. /**
  1284. * Enable or disable the display of this column. Since: 1.10
  1285. */
  1286. visible?: boolean;
  1287. /**
  1288. * Column width assignment. Since: 1.10
  1289. */
  1290. width?: string;
  1291. }
  1292. interface ColumnDefsSettings extends ColumnSettings {
  1293. targets: string | number | (number | string)[]
  1294. }
  1295. interface FunctionColumnCreatedCell {
  1296. (cell: Node, cellData: any, rowData: any, row: number, col: number): void;
  1297. }
  1298. interface FunctionColumnData {
  1299. (row: any, t: string, s: any, meta: CellMetaSettings): void;
  1300. }
  1301. interface ObjectColumnData {
  1302. _: string;
  1303. filter?: string;
  1304. display?: string;
  1305. type?: string;
  1306. sort?: string;
  1307. }
  1308. interface ObjectColumnRender extends ObjectColumnData {
  1309. }
  1310. interface FunctionColumnRender {
  1311. (data: any, t: string, row: any, meta: CellMetaSettings): void;
  1312. }
  1313. interface CellMetaSettings {
  1314. row: number;
  1315. col: number;
  1316. settings: DataTables.Settings;
  1317. }
  1318. //#endregion "colunm-settings"
  1319. //#region "other-settings"
  1320. export interface RendererSettings {
  1321. header?: string;
  1322. pageButton?: string;
  1323. }
  1324. export interface SearchSettings {
  1325. /**
  1326. * Control case-sensitive filtering option. Since: 1.10
  1327. */
  1328. caseInsensitive?: boolean;
  1329. /**
  1330. * Enable / disable escaping of regular expression characters in the search term. Since: 1.10
  1331. */
  1332. regex?: boolean;
  1333. /**
  1334. * Enable / disable DataTables' smart filtering. Since: 1.10
  1335. */
  1336. smart?: boolean;
  1337. /**
  1338. * Set an initial filtering condition on the table. Since: 1.10
  1339. */
  1340. search?: string;
  1341. }
  1342. //#endregion "other-settings"
  1343. //#region "callback-functions"
  1344. interface FunctionCreateRow {
  1345. (row: Node, data: any[] | Object, dataIndex: number): void;
  1346. }
  1347. interface FunctionDrawCallback {
  1348. (settings: SettingsLegacy): void;
  1349. }
  1350. interface FunctionFooterCallback {
  1351. (tfoot: Node, data: any[], start: number, end: number, display: any[]): void;
  1352. }
  1353. interface FunctionFormatNumber {
  1354. (formatNumber: number): void;
  1355. }
  1356. interface FunctionHeaderCallback {
  1357. (thead: Node, data: any[], start: number, end: number, display: any[]): void;
  1358. }
  1359. interface FunctionInfoCallback {
  1360. (settings: SettingsLegacy, start: number, end: number, mnax: number, total: number, pre: string): void;
  1361. }
  1362. interface FunctionInitComplete {
  1363. (settings: SettingsLegacy, json: Object): void;
  1364. }
  1365. interface FunctionPreDrawCallback {
  1366. (settings: SettingsLegacy): void;
  1367. }
  1368. interface FunctionRowCallback {
  1369. (row: Node, data: any[] | Object, index: number): void;
  1370. }
  1371. interface FunctionStateLoadCallback {
  1372. (settings: SettingsLegacy): void;
  1373. }
  1374. interface FunctionStateLoaded {
  1375. (settings: SettingsLegacy, data: Object): void;
  1376. }
  1377. interface FunctionStateLoadParams {
  1378. (settings: SettingsLegacy, data: Object): void;
  1379. }
  1380. interface FunctionStateSaveCallback {
  1381. (settings: SettingsLegacy, data: Object): void;
  1382. }
  1383. interface FunctionStateSaveParams {
  1384. (settings: SettingsLegacy, data: Object): void;
  1385. }
  1386. //#endregion "callback-functions"
  1387. //#region "language-settings"
  1388. // these are all optional
  1389. interface LanguageSettings {
  1390. emptyTable?: string;
  1391. info?: string;
  1392. infoEmpty?: string;
  1393. infoFiltered?: string;
  1394. infoPostFix?: string;
  1395. thousands?: string;
  1396. lengthMenu?: string;
  1397. loadingRecords?: string;
  1398. processing?: string;
  1399. search?: string;
  1400. zeroRecords?: string;
  1401. paginate?: LanguagePaginateSettings;
  1402. aria?: LanguageAriaSettings;
  1403. url?: string;
  1404. }
  1405. interface LanguagePaginateSettings {
  1406. first: string;
  1407. last: string;
  1408. next: string;
  1409. previous: string;
  1410. }
  1411. interface LanguageAriaSettings {
  1412. sortAscending: string;
  1413. sortDescending: string;
  1414. }
  1415. //#endregion "language-settings"
  1416. //#endregion "Settings"
  1417. //#region "SettingsLegacy"
  1418. interface ArrayStringNode {
  1419. [index: string]: Node;
  1420. }
  1421. export interface SettingsLegacy {
  1422. ajax: any;
  1423. oApi: any;
  1424. oFeatures: FeaturesLegacy;
  1425. oScroll: ScrollingLegacy;
  1426. oLanguage: LanguageLegacy; // | { fnInfoCallback: FunctionInfoCallback; };
  1427. oBrowser: { bScrollOversize: boolean; };
  1428. aanFeatures: ArrayStringNode[][];
  1429. aoData: RowLegacy[];
  1430. aiDisplay: number[];
  1431. aiDisplayMaster: number[];
  1432. aoColumns: ColumnLegacy[];
  1433. aoHeader: any[];
  1434. aoFooter: any[];
  1435. asDataSearch: string[];
  1436. oPreviousSearch: any;
  1437. aoPreSearchCols: any[];
  1438. aaSorting: any[][];
  1439. aaSortingFixed: any[][];
  1440. asStripeClasses: string[];
  1441. asDestroyStripes: string[];
  1442. sDestroyWidth: number;
  1443. aoRowCallback: FunctionRowCallback[];
  1444. aoHeaderCallback: FunctionHeaderCallback[];
  1445. aoFooterCallback: FunctionFooterCallback[];
  1446. aoDrawCallback: FunctionDrawCallback[];
  1447. aoRowCreatedCallback: FunctionCreateRow[];
  1448. aoPreDrawCallback: FunctionPreDrawCallback[];
  1449. aoInitComplete: FunctionInitComplete[];
  1450. aoStateSaveParams: FunctionStateSaveParams[];
  1451. aoStateLoadParams: FunctionStateLoadParams[];
  1452. aoStateLoaded: FunctionStateLoaded[];
  1453. sTableId: string;
  1454. nTable: Node;
  1455. nTHead: Node;
  1456. nTFoot: Node;
  1457. nTBody: Node;
  1458. nTableWrapper: Node;
  1459. bDeferLoading: boolean;
  1460. bInitialized: boolean;
  1461. aoOpenRows: any[];
  1462. sDom: string;
  1463. sPaginationType: string;
  1464. iCookieDuration: number;
  1465. sCookiePrefix: string;
  1466. fnCookieCallback: CookieCallbackLegacy;
  1467. aoStateSave: FunctionStateSaveCallback[];
  1468. aoStateLoad: FunctionStateLoadCallback[];
  1469. oLoadedState: any;
  1470. sAjaxSource: string;
  1471. sAjaxDataProp: string;
  1472. bAjaxDataGet: boolean;
  1473. jqXHR: any;
  1474. fnServerData: any;
  1475. aoServerParams: any[];
  1476. sServerMethod: string;
  1477. fnFormatNumber: FunctionFormatNumber;
  1478. aLengthMenu: any[];
  1479. iDraw: number;
  1480. bDrawing: boolean;
  1481. iDrawError: number;
  1482. _iDisplayLength: number;
  1483. _iDisplayStart: number;
  1484. _iDisplayEnd: number;
  1485. _iRecordsTotal: number;
  1486. _iRecordsDisplay: number;
  1487. bJUI: boolean;
  1488. oClasses: any;
  1489. bFiltered: boolean;
  1490. bSorted: boolean;
  1491. bSortCellsTop: boolean;
  1492. oInit: any;
  1493. aoDestroyCallback: any[];
  1494. fnRecordsTotal: () => number;
  1495. fnRecordsDisplay: () => number;
  1496. fnDisplayEnd: () => number;
  1497. oInstance: any;
  1498. sInstance: string;
  1499. iTabIndex: number;
  1500. nScrollHead: Node;
  1501. nScrollFoot: Node;
  1502. }
  1503. export interface FeaturesLegacy {
  1504. bAutoWidth: boolean;
  1505. bDeferRender: boolean;
  1506. bFilter: boolean;
  1507. bInfo: boolean;
  1508. bLengthChange: boolean;
  1509. bPaginate: boolean;
  1510. bProcessing: boolean;
  1511. bServerSide: boolean;
  1512. bSort: boolean;
  1513. bSortClasses: boolean;
  1514. bStateSave: boolean;
  1515. }
  1516. export interface ScrollingLegacy {
  1517. bAutoCss: boolean;
  1518. bCollapse: boolean;
  1519. bInfinite: boolean;
  1520. iBarWidth: number;
  1521. iLoadGap: number;
  1522. sX: string;
  1523. sY: string;
  1524. }
  1525. export interface RowLegacy {
  1526. nTr: Node;
  1527. _aData: any;
  1528. _aSortData: any[];
  1529. _anHidden: Node[];
  1530. _sRowStripe: string;
  1531. }
  1532. export interface ColumnLegacy {
  1533. aDataSort: any;
  1534. asSorting: string[];
  1535. bSearchable: boolean;
  1536. bSortable: boolean;
  1537. bVisible: boolean;
  1538. _bAutoType: boolean;
  1539. fnCreatedCell: FunctionColumnCreatedCell;
  1540. fnGetData: (data: any, specific: string) => any;
  1541. fnSetData: (data: any, value: any) => void;
  1542. mData: any;
  1543. mRender: any;
  1544. nTh: Node;
  1545. nIf: Node;
  1546. sClass: string;
  1547. sContentPadding: string;
  1548. sDefaultContent: string;
  1549. sName: string;
  1550. sSortDataType: string;
  1551. sSortingClass: string;
  1552. sSortingClassJUI: string;
  1553. sTitle: string;
  1554. sType: string;
  1555. sWidth: string;
  1556. sWidthOrig: string;
  1557. }
  1558. export interface CookieCallbackLegacy {
  1559. (name: string, data: any, expires: string, path: string, cookie: string): void;
  1560. }
  1561. export interface LanguageLegacy {
  1562. oAria?: LanguageAriaLegacy;
  1563. oPaginate?: LanguagePaginateLegacy;
  1564. sEmptyTable?: string;
  1565. sInfo?: string;
  1566. sInfoEmpty?: string;
  1567. sInfoFiltered?: string;
  1568. sInfoPostFix?: string;
  1569. sInfoThousands?: string;
  1570. sLengthMenu?: string;
  1571. sLoadingRecords?: string;
  1572. sProcessing?: string;
  1573. sSearch?: string;
  1574. sUrl?: string;
  1575. sZeroRecords?: string;
  1576. }
  1577. export interface LanguageAriaLegacy {
  1578. sSortAscending?: string;
  1579. sSortDescending?: string;
  1580. }
  1581. export interface LanguagePaginateLegacy {
  1582. sFirst?: string;
  1583. sLast?: string;
  1584. sNext?: string;
  1585. sPrevious?: string;
  1586. }
  1587. //#endregion "SettingsLegacy"
  1588. }