I’m currently working on a project using JsonForms and I need to include a date-time picker within an array in my form. I have successfully set up basic forms, but I’m having trouble configuring a date-time element inside an array structure. Below is the schema and UI schema configuration that I’ve tried, but it doesn’t render the date-time picker as expected. const schema = {
type: “object”,
properties: {
test: {
type: “array”,
items: {
type: “object”,
title: “Test”,
properties: {
option1: {
type: “string”,
format: “date-time”,
description: “schema-based datetime picker”,
},
option2: {
type: “string”,
format: “date”,
},
option3: {
type: “string”,
format: “time”,
},
},
required: [“firstname”, “time”],
},
},
},
};
I’m assuming you are using the React Material renderers.
We do not support customizing elements of the Table renderer via the UI Schema. However you can switch to the non-table style by using a detail UI Schema.
To note: The documentation is a bit outdated as the Material UI Date pickers are fast moving. At the moment most of the labels can no longer be customized as we don’t show any labels at the moment.
Also note that if you specify a saveFormat which is different from the format defined in the JSON Schema, you will get validation errors. To avoid that, simply type that field as a string without a format in the JSON Schema and instead add the format into the UI Schema.
Hi! First of all, thanks for your quick response! I understand the schema you provided, but what I’m looking for is a way to display all the elements of the list without having to select them one by one to view their details. In other words, I would like to see a list of fields of type date-time all at once in a list format.
Thank you in advance for your help!
Our off-the-shelf renderers don’t support UI Schema options for the table use case. Therefore you will need to implement your use case(s) with custom (cell) renderers.