createTableRpc
The createTableRpc
function sets up server-side endpoint to handle request from the table. It connects to a database and defines what data available for the table and how it behaves.
Parameters
table
Specifies the name of the database table.
primaryKeyColumn
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
Sets the number of records displayed per page for table pagination.
columns
Specifies the columns to include in the query and display by default.
If not specified, all columns (*)
will be included in the query.
excludeColumns
Specifies columns to exclude from the query, often used to omit sensitive data such as password hashes or payment details.
searchableColumns
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
Enables sorting functionality by clicking on column headers. Specifies the columns that can be sorted.
filterableColumns
Adds a "Filters" button at the top of the table. Specifies the columns that can be used as filters.
insert
Defines settings for inserting records into the table.
columns
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
Specifies the columns to exclude from the insert query. This is commonly used for system-generated or sensitive data.
beforeInsert()
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()
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
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
Specifies the columns to exclude from the update query. This is commonly used for system-generated or sensitive data.
beforeUpdate()
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()
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()
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
Preloads records from related tables or creates joins. It displays linked records in the table and lets users select records from the related table when inserting or updating records.
oneToOne
Defines a one-to-one relationship between two tables.
oneToMany
Defines a one-to-many relationship where one record in the current table can be linked to multiple records in the related table.
manyToMany
This feature is not yet supported. In the future, it will allow users to link records using junction tables.
Last updated