I retrieve data from an API that is not allowed to be changed from within the panel.
For this I use disabled: true.
However, dates from the API are in a not human friendly format, like 2023-04-07T20:30:00+02:00.
My solution is that I hide the disabled input with CSS and display the date in the label, like this: programstart: label: "Date: {{ page.programstart().toDate('d-m-Y') }}" type: text disabled: true
This works good, however the label is bold by default, which is usually fine, but I would like to display the actual date in normal font weight.
My idea was to put a span around it to style in CSS, like label: "Date: <span>{{ page.programstart().toDate('d-m-Y') }}</span>"
or label: "Date: {{ <span> page.programstart().toDate('d-m-Y') </span>}}".
Not sure how labels are rendered, maybe with Str::safeTemplate() or Str::template()?
If it’s Str::template(), the method doesn’t take {< >} into account at all.
Very interested in this as well, but I can’t find the corresponding part in the source code.
It seems that panel.js is not (re)loaded/(re)triggered when you navigate to a different page in the panel, so it only works if you reload the page manually.
What about storing those disabled fields in a hidden field and displaying their values in an info field instead? Return your value including the HTML from a page model as before.
Targeting .k-info-field with data-theme="none" I have this CSS to make it look the way I want it. Unfortunately :has is not supported in Firefox yet, but my clients will not use that browser.
I use it as my development browser, but I can live with the default layout.