Ninox 4 – Custom Component reading linked records makes the form jump on record change. Best practice?
Hi everyone,
I'd like to understand how Custom Components render in Ninox 4 when they read data from linked tables.
Generic setup:
- Table A has N:1 links to Table B and Table C.
- At the top of Table A's form there is a Custom Component (header) that displays values from the linked records, for example an image URL from B (linkB.image_url) and a name from C (linkC.name), together with some fields of the current record.
What happens:
When navigating between records in Table A (up/down arrows), the component disappears for a moment, the whole form shifts up, then the component renders without the linked data, and finally the linked values/images appear and the layout moves again. Using a fixed height on the component container and fixed-size placeholders for images did not prevent the shift.
Workaround that fixed it:
I added Text fields in Table A to store copies of the linked values, filled them with a script, and changed the component to read only fields of the current record. Now the form stays stable and only the images load in place.
Questions:
1. Is it expected that a Custom Component waits for linked records to load before rendering, without reserving its space?
2. Is copying linked values into local fields (denormalising) the recommended practice in Ninox 4, or is there a better approach, e.g. a setting, a loading placeholder, or a more efficient way to read linked records inside a component?
3. Is reading through a relation (e.g. linkB.field or a reverse relation) faster than using select … where inside a component, and does it affect rendering?
Thanks in advance for any insights!
4 Antworten
-
Hallo
Als Hinweis:
Das ist das deutsche Forum. Bitte erstelle deine Beiträge hier auf deutsch.
Wenn du auf english schreiben willst, kannst du dafür das englische Forum nutzen.
Zu deiner Anfrage:
Ich habe deine Anforderung in einer BeispielApp auf einfache Art nachgebaut.
Ich kann das von dir beschriebene Verhalten bei Linkfeldern bei 'benutzerdefinierten Komponenten' nicht als grundsätzlich nachvollziehen.
Die 'benutzerdefinierte Komponente' löst ja die html-Funktion, welche in Ninox3 in Berechnungsfeldern genutzt wurde ab.
In wieweit in 'benutzerdefinierten Komponenten' umfangreiches Scripting betrieben wird liegt ja bei dem Anwender selbst.
Meine Tests haben ergeben, dass bei einfachen html-Script der Formularaufbau beim Wechsel zwischen Records grundsätzlich keine Verzögerung mit sich bringt.
Der Inhalt des Feldes 'benutzerdefinierte Komponente' wird vollständig und sofort angezeigt.
Ich füge ein Screenvideo bei, welches meinen Nachbau in einfacher Form zeigt und das Script, welches ich für die 'benutzerdefinierte Komponente' verwendet habe.
Script verwendete 'benutzerdefinierte Komponente'function Row(label: string, value: any) do <div class="flex flex-col"> <span class="text-xs text-default-500"> { label } </span> <span class="text-lg font-semibold"> { value } </span> </div> end; <div class="flex flex-col gap-3 p-4 rounded-lg bg-content1 text-foreground shadow"> <Row label="FieldTblA:" value={ name }/> <Row label="FieldTblB:" value={ tableb.company }/> <Row label="FieldTblC:" value={ tablec.ort }/> </div>
Content aside
- vor 4 StundenZuletzt aktiv
- 4Antworten
- 12Ansichten
-
2
Folge bereits
