Skip to content

Commit

Permalink
Typescript: Add DataTable.Responsive.bootstrap() function to regist…
Browse files Browse the repository at this point in the history
…er bootstrap

Typescript: Correct modal type for display rendering
  • Loading branch information
AllanJard committed Mar 26, 2024
1 parent 5e187b2 commit 21e117d
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ declare module 'datatables.net' {
breakpoints: ResponsiveBreakpoint[];

display: {
childRow: ResponsiveDisplay,
childRowImmediate: ResponsiveDisplay,
modal: ResponsiveDisplay,
/** Display details as a child row, when requested (click) */
childRow: ResponsiveDisplay;

/** Display details as a child row, immediately (no-click) */
childRowImmediate: ResponsiveDisplay;

/** Display details as a modal */
modal: (options?: ResponsiveModalOptions) => ResponsiveDisplay;
};

/**
Expand All @@ -91,6 +96,13 @@ declare module 'datatables.net' {
* Responsive version
*/
version: string;

/**
* Set the Bootstrap library to use
*
* @param bs Bootstrap - from `import * as bootstrap from 'bootstrap';`
*/
bootstrap: (bs: any) => void;
}
}
}
Expand Down Expand Up @@ -159,7 +171,7 @@ interface ConfigResponsiveDetails {
* @param render The data to be shown - this is given as a function so it will be executed only when required (i.e. there is no point in gather data to display if the display function is simply going to hide it). The string returned by this function is that given by the responsive.details.renderer function. It accepts no input parameters.
* @returns boolean true if the display function has shown the hidden data, false
*/
display?(row: ApiRow<any>, update: boolean, render: () => string): boolean;
display?: ResponsiveDisplay;

/**
* Define the renderer used to display the child rows.
Expand Down Expand Up @@ -219,6 +231,10 @@ interface ResponsiveDisplay {
(row: Api<any>, update: boolean, render: () => Node): boolean;
}

interface ResponsiveModalOptions {
header?(row: any): string;
}

interface ResponsiveColumn {
className: string;
columnIndex: number;
Expand Down

0 comments on commit 21e117d

Please sign in to comment.