Ga naar hoofdinhoud

CnSwitchRowsWidget

A card of switches, each with a label and a hint, bound to boolean fields of the CURRENT object. A toggle saves at once. Registered under the switch-rows widget type.

A portal's "Verkeer meten", "Berichtenbox van MijnOverheid" and "Als app installeren", and a settings card of "Verplichte velden" are this shape.

Content shape​

{
"id": "portal-install",
"type": "switch-rows",
"title": "Als app installeren",
"content": {
"rows": [
{ "key": "installEnabled", "label": "Bezoekers kunnen de portal installeren op hun telefoon", "hint": "De app bewaart alleen de schil van de site." }
]
}
}
KeyMeaning
rows[].keyA top-level boolean field of the object.
rows[].label, rows[].hintTexts, translated through cnTranslate.
rows[].invertThe switch is on when the field is false (a stored installDisabled read as "on").
readOnlyDisables every switch.

Behaviour​

  • A toggle sends ONE PATCH of that field. The switch is disabled while the request runs.
  • A refused PATCH puts the switch back to its last saved state and shows the server's own words.

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.
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.
  • Renderer only: no config form.