Skip to main content

CnObjectLinksWidget

A record's links to other records, each kept as an object of a link schema. Registered under the object-links widget type.

Board PqKlant "Relaties" reads "Secretaris van Buurtvereniging Oost" and "Partner van J. de Vries": a link's type in words, then the other record's name as a link to its page, with one "Toevoegen" in the title row. The link objects name this record (from) and the other one (to); the other one can be a record of more than one schema (a contact person or a client), so a link also says which kind it points at (toType).

Content shape​

{
"id": "client-relationships",
"type": "object-links",
"title": "Relationships",
"content": {
"register": "pipelinq",
"schema": "relationship",
"from": "fromContact",
"to": "toContact",
"fromType": "fromType",
"toType": "toType",
"selfType": "client",
"typeField": "type",
"inverseField": "inverseType",
"groupField": "category",
"pair": true,
"types": [
{ "value": "partner", "label": "Partner of", "inverse": "partner", "group": "Family" },
{ "value": "werkgever", "label": "Employer of", "inverse": "werknemer", "group": "Professional" }
],
"targets": [
{ "type": "contact", "register": "pipelinq", "schema": "contact", "titleField": "name", "label": "contact", "route": "ContactDetail" },
{ "type": "client", "register": "pipelinq", "schema": "client", "titleField": "name", "label": "client", "route": "ClientDetail" }
],
"fields": [
{ "key": "notes", "label": "Notes", "type": "textarea" },
{ "key": "startDate", "label": "Start date", "type": "date" },
{ "key": "endDate", "label": "End date", "type": "date" }
],
"defaults": { "provenance": "declared" },
"add": { "label": "Add", "ariaLabel": "Add relationship", "placement": "title" },
"remove": { "label": "Remove" },
"emptyText": "No relationships yet."
}
}
KeyMeaning
register, schemaWhere the link objects live (required).
from, toThe link fields that hold this record's id and the other record's id (required). The list reads the links whose from is this record.
fromType, toType, selfTypeThe fields that name each side's kind, and this record's kind. A row reads the name from the target its toType names, else the first target.
typeField, inverseField, groupFieldThe fields a new link's type, inverse type and group are written to.
types[]{ value, label, inverse?, group?, groupLabel? }: the choices in the dialog ("Partner of (Family)") and how a row words its type. group is the value written to groupField; groupLabel words it in the dialog when the stored value is not the words. A stored type without an entry shows as stored.
targets[]{ type, register, schema, titleField?, label?, route? }: the kinds of record a link can point at. The dialog searches each (_search, ten each, this record left out) and shows label under a result; a row links to route with params.id. titleField defaults to name.
pairWrite the inverse link from the other record on add, and delete it on remove.
fields[]{ key, label, type?: "text" | "textarea" | "date" }: extra values the dialog asks; empty ones are not written.
defaultsValues written on every new link.
filter, limitExtra list filters; how many links to read (default 100).
add{ label?, ariaLabel?, placement?, dialogTitle? }. "title" reports the Add on the header event for the card's title row; otherwise it is a button under the list.
remove{ label? }: Remove in each row's "..." menu. Omitted: no remove.
readOnlyNo add and no remove.
emptyText, duplicateText, targetLabel, typeLabelTexts, translated through the host app.

A link to the same record with the same type is refused before anything is written. Every write goes to OpenRegister, which checks the user's rights before it writes; a refusal shows in the server's words. Without a record id or a link schema the widget sends nothing.

Props​

PropTypeDefaultDescription
contentobject{}The configuration above.
objectDataobjectnullThe current detail-page record.
objectIdstring|number''The record id.

Events​

EventPayloadDescription
header{ actions }The title-row Add (add.placement: "title"), or no actions.

Notes​

  • Content-only on the detail page: the host draws the titled card.
  • Renderer only: no config form.