Managed Data Table
An advanced version of the ‘Table View’ component. In addition to just displaying the table, this component allows the creator to specify: exactly which rows of the table to be shown (via a custom SQL query), a custom form for adding/modifying rows, and permissions for adding, modifying, and/or deleting rows of the table. Note that this component requires that the table have a key column. The primary add button uses the text Add followed by the table’s labelSingular when set on the table; otherwise it uses the table name.
Outline Display: Presents an editable table that uses a modal to add/edit entries.
We will draw data from {{tab}}.
We will display data from {{linkedQuery}}. Permissions for deletion are set by {{delPermission}} and for adding/editing by {{modifyPermission}}.
{{customShow:The query results are shown with the following custom rules: {{customShow}}}}
When a user wants to edit a row, they will see a form constructed of:
{{rowIngredients}}
Details
Supports sqlFilter ingredients for user-facing filter widgets (dropdowns, range inputs) that add WHERE clauses to the linkedQuery. The table auto-refreshes via ChangeWatcher when underlying data changes. The default sort direction is configurable. The key column can optionally be hidden. Per-row permission formulas control who can delete or modify each row. Optional onAdd, onDelete, and onModify callback actions run after the corresponding table operation completes.
Requirements
The linkedQuery SQL query must: (1) Include the table’s key column with its EXACT original name as both column reference and alias. (2) Select all columns you want displayed. (3) Use fully qualified column names: “TableName”.“ColumnName”. (4) Give each selected column an AS alias matching the column name. (5) May include WHERE, ORDER BY, or other clauses as needed. CORRECT PATTERN: SELECT “Table”.“KeyColumn” AS “KeyColumn”, “Table”.“Column1” AS “Column1”, “Table”.“Column2” AS “Column2” FROM “Table” ORDER BY “Table”.“Column1” DESC. The key column must appear with its exact name – do NOT rename it.
Local scope
Names introduced within this component’s knobs:
uiArgs– virtual table holding this handler’s parameterstab– table chosen from the app’s schema (viatabknob)key– key column oftabqueryTab– result columns oflinkedQuery(referenceable as a virtual table)formFieldsTable– empty table populated by ingredientstable– renamed copy oftab
Settings
Required
-
tab: table
The table to connect to -
linkedQuery: SQL query
A SQL query that returns all of the rows to display.
Must produce: result matching exactly type ofkey, then any number of results matching any type
Scope: all columns ofuiArgs(reference as[ColumnName], e.g.,[Name],[Price]), current username as[Username](only where the handler authenticates: a logged-in page, or the calling user of an MCP tool, including inside its pipeline). -
rowIngredients: ingredient slot offormIngredients(tab, formFieldsTable)(many, untilformFieldsTable>=tab)
Descriptions for widgets or other ways of asking the user for information to construct a row in the table. Note that the order of the ingredients will be reflected in the order of the form and that there must be an ingredient to produce each column in the table. Key columns should use SequentialID.
Optional
-
sqlFilter: ingredient slot ofsqlFilterIngredients(linkedQuery)(many)
GUI widgets for letting the user filter the query -
defaultSortAscending: constant value (type: bool; required, non-nullable)
Should we default to sort ascending? -
shouldShowKey: constant value (type: bool; required, non-nullable)
Should the key be one of the shown columns? -
delPermission: formula (returns bool; required, non-nullable)
A boolean formula that determines whether a user can delete a row (‘True’ allows them to delete any row)
Scope: all columns oftab(reference as[ColumnName], e.g.,[Name],[Price]) -
modifyPermission: formula (returns bool; required, non-nullable)
A boolean formula that determines whether a user can modify a row (‘True’ allows them to modify any row)
Scope: all columns oftab(reference as[ColumnName], e.g.,[Name],[Price]) -
customShow: ingredient slot ofcustomShowIngredientsList(table)(many)
Custom ways to show columns -
onAdd: ingredient slot ofrowActionsIngredients(tab)(many)
The action(s) to be performed on each row that the user adds. Note that the row has already been added to the table – this field is only required if additional actions should be performed. -
onDelete: ingredient slot ofrowActionsIngredients(tab)(many)
The action(s) to be performed on each row that the user clicks to delete. Note that the row has already been deleted from the table – this field is only required if additional actions should be performed. -
onModify: ingredient slot ofrowActionsIngredients(tab)(many)
The action(s) to be performed on each row that the user modifies. Note that the row has already been modified in the table – this field is only required if additional actions should be performed.