createTableRpc
The createTableRpc
function sets up server-side endpoint to handle request from the page with the table component. It connects to a database and defines what data available for the table and how it behaves.
Usage
The createTableRpc
function takes two required arguments:
dataSource
: A data source.parameters
: A set of parameters.
Parameters
table
string
, optional
Specifies the name of the database table.
primaryKeyColumn
string
, optional
Specifies the primary key column in the table. Typically, this is set to "id"
.
select
Defines settings for selecting and displaying data in the table.
pageSize
number
, optional
Sets the number of records displayed per page for table pagination.
columns
string[]
, optional
Specifies the columns to include in the query and display by default.
If not specified, all columns (*)
will be included in the query.
excludeColumns
string[]
, optional
Specifies columns to exclude from the query, often used to omit sensitive data such as password hashes or payment details.
searchableColumns
string[]
, optional
Enables a search input at the top of the table. Specifies the columns that are searchable, typically applicable to text or numeric column types.
sortableColumns
string[]
, optional
Enables sorting functionality by clicking on column headers. Specifies the columns that can be sorted.
filterableColumns
string[]
, optional
Adds a "Filters" button at the top of the table. Specifies the columns that can be used as filters.
executeQuery
function
, optional
Allow to define define custom fetching logic.
Learn more: Custom queries
insert
Defines settings for inserting records into the table.
columns
string[]
, optional
Specifies the columns to include in the insert form by default. These are the columns the user can provide values for during record creation.
If not specified, all columns will be available in the insert form.
excludeColumns
string[]
, optional
Specifies the columns to exclude from the insert query. This is commonly used for system-generated or sensitive data.
beforeInsert
function
, optional
A function executed on the record before it is inserted into the table. This function is often used to format data, add missing but required properties, or generate sensitive data that the user should not input directly (e.g., password hashes, access tokens).
canBeInserted
function
, optional
A function for server-side validation before a record is inserted.
If the function returns true
, the record is inserted.
If it returns false
or throws an Error
, the record is not inserted, and the user receives an error message.
update
Defines settings for updating records in the table.
columns
string[]
, optional
Specifies the columns to include in the update form by default. These are the columns the user can provide values for during record update.
If not specified, all columns will be available in the update form.
excludeColumns
string[]
, optional
Specifies the columns to exclude from the update query. This is commonly used for system-generated or sensitive data.
beforeUpdate
function
, optional
A function executed on the record before it is updated in the table. This function is often used to format data, add missing but required properties, or generate sensitive data that the user should not input directly (e.g., password hashes, access tokens).
canBeUpdated
function
, optional
A function for server-side validation before a record is updated.
If the function returns true
, the record is updated.
If it returns false
or throws an Error
, the record is not updated, and the user receives an error message.
delete
canBeDeleted
function
, optional
A function for server-side validation before a record is deleted.
If the function returns true
, the record is deleted.
If it returns false
or throws an Error
, the record is not deleted, and the user receives an error message.
linked
Allows linked records to be displayed in the table and enables users to select related records when adding or updating records.
Learn more: Linked records (Joins)
Last updated