Ga naar hoofdinhoud

CnToggleTableWidget

Rows from a configured list or a source, each with a switch bound to the CURRENT object, and optional extra columns. A toggle saves at once. Registered under the toggle-table widget type.

A portal's sign-in methods (Inlogwijze, Route, a switch) and "Zaaktypen die inwoners zien" (a case type per row, switched on or off) are this shape.

Content shape​

{
"id": "portal-case-types",
"type": "toggle-table",
"title": "Zaaktypen die inwoners zien",
"content": {
"bind": { "mode": "list", "field": "hiddenCaseTypes", "invert": true },
"source": { "url": "/apps/portaliq/api/case-types?portal=@object.slug", "path": "results", "key": "id", "label": "name", "hint": "hint" }
}
}
{
"id": "portal-signin",
"type": "toggle-table",
"title": "Inloggen",
"content": {
"titleHeader": "Inlogwijze",
"toggleHeader": "Aan",
"columns": [{ "header": "Route", "path": "route" }],
"rows": [{ "key": "digid", "label": "DigiD", "field": "signinDigid", "route": "via integriq, de koppeling van de gemeente" }]
}
}
KeyMeaning
bind.modeflag (default): each row names a boolean field of the object in row.field. list: one array field, bind.field, holds the keys of the rows that are in it.
bind.invertList mode only: the switch is ON when the key is NOT in the list (a list of hidden items shown as visible switches).
rows[]Static rows: { key, label, hint?, field?, ...extra }. Texts go through cnTranslate.
source{ url, path?, key, label, hint? }: rows read from an endpoint after the static rows; the url takes @objectId and @object.<field> tokens.
columns[]Extra columns: { header, path, map? }, read off each row; map translates stored values.
titleHeader, toggleHeaderHeader texts; the header row shows when there are columns or either header is set.
emptyText, readOnlyText for no rows; disable every switch.

Behaviour​

  • A toggle sends ONE PATCH: the row's field with the new boolean (flag), or the list field with the key added or removed (list). The switch is disabled while it runs.
  • A refused PATCH shows the server's own words and the switch is drawn again from the stored value.

Props​

PropTypeDefaultDescription
contentobject{}The configuration above.
objectDataobjectnullThe current detail-page object; switches are read from it.
objectIdstring|number''The object id, for the PATCH url and the @objectId token.
registerstring|object''Register slug of the surface, for the PATCH url.
schemastring|object''Schema slug of the surface, for the PATCH url.

Events​

EventPayloadDescription
saved{ field, value }After a successful PATCH of one switch.

Notes​

  • Content-only on the detail page: it gets the titled card; inside a sections widget it renders bare.
  • Static switches without columns or a source: switch-rows.
  • Renderer only: no config form.