Kottster Packages API Reference
    Preparing search index...

    Interface PartialTablePageConfig

    interface PartialTablePageConfig {
        afterDelete?: (primaryKey: any) => void | Promise<void>;
        afterInsert?: (
            primaryKey: any,
            values: Record<string, any>,
        ) => void | Promise<void>;
        afterUpdate?: (
            primaryKey: any,
            values: Record<string, any>,
        ) => void | Promise<void>;
        allowDelete?: boolean;
        allowedRoleIdsToDelete?: string[];
        allowedRoleIdsToInsert?: string[];
        allowedRoleIdsToUpdate?: string[];
        allowedRolesToDelete?: string[];
        allowedRolesToInsert?: string[];
        allowedRolesToUpdate?: string[];
        allowInsert?: boolean;
        allowUpdate?: boolean;
        calculatedColumns?: TablePageConfigCalculatedColumn[];
        columns?: TablePageConfigColumn[];
        customDataFetcher?: (
            input: TablePageCustomDataFetcherInput,
        ) => Promise<TablePageGetRecordsResult>;
        customSqlCountQuery?: string;
        customSqlQuery?: string;
        dataSource?: string;
        defaultSortColumn?: string;
        defaultSortDirection?: "asc" | "desc";
        fetchStrategy?: "databaseTable" | "rawSqlQuery" | "customFetch";
        knexQueryModifier?: any;
        linkedRecordsColumns?: TablePageConfigLinkedRecordsColumn[];
        nested?: { [key: string]: PartialTablePageConfig };
        pageSize?: number;
        primaryKeyColumn?: string;
        relationships?: Relationship[];
        table?: string;
        transformRecordBeforeInsert?: (
            values: Record<string, any>,
        ) => Record<string, any> | Promise<Record<string, any>>;
        transformRecordBeforeUpdate?: (
            primaryKey: any,
            values: Record<string, any>,
        ) => Record<string, any> | Promise<Record<string, any>>;
        validateRecordBeforeDelete?: (
            primaryKey: any,
        ) => boolean | Promise<boolean>;
        validateRecordBeforeInsert?: (
            values: Record<string, any>,
        ) => boolean | Promise<boolean>;
        validateRecordBeforeUpdate?: (
            primaryKey: any,
            values: Record<string, any>,
        ) => boolean | Promise<boolean>;
        views?: TablePageConfigView[];
    }

    Hierarchy

    Index

    Properties

    afterDelete?: (primaryKey: any) => void | Promise<void>

    Function to execute after a record is deleted. This can be used to perform custom actions after deletion

    Type Declaration

      • (primaryKey: any): void | Promise<void>
      • Parameters

        • primaryKey: any

          The primary key of the record that was deleted

        Returns void | Promise<void>

    afterInsert?: (
        primaryKey: any,
        values: Record<string, any>,
    ) => void | Promise<void>

    Function to execute after a record is inserted. This can be used to perform custom actions after insertion

    Type Declaration

      • (primaryKey: any, values: Record<string, any>): void | Promise<void>
      • Parameters

        • primaryKey: any

          The primary key of the record that was inserted

        • values: Record<string, any>

          The values of the record that was inserted

        Returns void | Promise<void>

    afterUpdate?: (
        primaryKey: any,
        values: Record<string, any>,
    ) => void | Promise<void>

    Function to execute after a record is updated. This can be used to perform custom actions after update

    Type Declaration

      • (primaryKey: any, values: Record<string, any>): void | Promise<void>
      • Parameters

        • primaryKey: any
        • values: Record<string, any>

          The values of the record that was updated

        Returns void | Promise<void>

    allowDelete?: boolean
    allowedRoleIdsToDelete?: string[]

    Legacy - to be removed in v4. Use allowedRolesToDelete instead

    allowedRoleIdsToInsert?: string[]

    Legacy - to be removed in v4. Use allowedRolesToInsert instead

    allowedRoleIdsToUpdate?: string[]

    Legacy - to be removed in v4. Use allowedRolesToUpdate instead

    allowedRolesToDelete?: string[]
    allowedRolesToInsert?: string[]
    allowedRolesToUpdate?: string[]
    allowInsert?: boolean
    allowUpdate?: boolean
    calculatedColumns?: TablePageConfigCalculatedColumn[]
    customDataFetcher?: (
        input: TablePageCustomDataFetcherInput,
    ) => Promise<TablePageGetRecordsResult>

    Custom fetcher function to retrieve data. The function should return records and total count

    Type Declaration

    customSqlCountQuery?: string
    customSqlQuery?: string
    dataSource?: string
    defaultSortColumn?: string

    Column name to sort by default

    defaultSortDirection?: "asc" | "desc"

    Default sort direction

    'desc'
    
    fetchStrategy?: "databaseTable" | "rawSqlQuery" | "customFetch"
    knexQueryModifier?: any
    linkedRecordsColumns?: TablePageConfigLinkedRecordsColumn[]
    nested?: { [key: string]: PartialTablePageConfig }
    pageSize?: number

    Deprecated since now users can now set page size in the UI

    primaryKeyColumn?: string
    relationships?: Relationship[]
    table?: string

    Set up using no-code

    transformRecordBeforeInsert?: (
        values: Record<string, any>,
    ) => Record<string, any> | Promise<Record<string, any>>

    Function to modify the record before inserting it.

    Type Declaration

      • (
            values: Record<string, any>,
        ): Record<string, any> | Promise<Record<string, any>>
      • Parameters

        • values: Record<string, any>

          The values of the record to be inserted

        Returns Record<string, any> | Promise<Record<string, any>>

        The modified record to be inserted

    transformRecordBeforeUpdate?: (
        primaryKey: any,
        values: Record<string, any>,
    ) => Record<string, any> | Promise<Record<string, any>>

    Function to modify the record before updating it.

    Type Declaration

      • (
            primaryKey: any,
            values: Record<string, any>,
        ): Record<string, any> | Promise<Record<string, any>>
      • Parameters

        • primaryKey: any

          The primary key of the record to be updated

        • values: Record<string, any>

          The values of the record to be updated

        Returns Record<string, any> | Promise<Record<string, any>>

        The modified record to be updated

    validateRecordBeforeDelete?: (primaryKey: any) => boolean | Promise<boolean>

    Function to execute before deleting a record. This can be used to perform custom actions before deletion

    Type Declaration

      • (primaryKey: any): boolean | Promise<boolean>
      • Parameters

        • primaryKey: any

          The primary key of the record to be deleted

        Returns boolean | Promise<boolean>

        A boolean indicating whether the record can be deleted

    validateRecordBeforeInsert?: (
        values: Record<string, any>,
    ) => boolean | Promise<boolean>

    Function to check if a record can be inserted. This can be used to perform custom validations before insertion

    Type Declaration

      • (values: Record<string, any>): boolean | Promise<boolean>
      • Parameters

        • values: Record<string, any>

          The values of the record to be inserted

        Returns boolean | Promise<boolean>

        A boolean indicating whether the record can be inserted

    validateRecordBeforeUpdate?: (
        primaryKey: any,
        values: Record<string, any>,
    ) => boolean | Promise<boolean>

    Function to modify the record before updating it.

    Type Declaration

      • (primaryKey: any, values: Record<string, any>): boolean | Promise<boolean>
      • Parameters

        • primaryKey: any

          The primary key of the record to be updated

        • values: Record<string, any>

          The values of the record to be updated

        Returns boolean | Promise<boolean>

        A boolean indicating whether the record can be updated

    Views for pre-defined filters or SQL WHERE clauses