Skip to main content

FieldGroups

Task

Our task is to have both the EntityFields MANUFACTURER and TYPE available in the first line of ViewTemplate CarPreviewCard (included in CarPreview_view), i.e., these 2 fields should be displayed side by side, not one upon the other:

field_group_view

When the edit button ("pencil") in the upper right corner is clicked, both EntityFields should be editable separately:

field_group_edit

tip

You can find helpful information on this topic in the generic part of the documentation, chapter Field Group.

Solution

Open Car_entity in the Navigator window, create a new FieldGroup, and give it a suitable name, e.g., MANUFACTURER_AND_TYPE_fieldGroup.

In ViewTemplate CarPreviewCard, select the new Field Group in property titleField.

valueProcess of FieldGroup
import { result, vars } from "@aditosoftware/jdito-types";
import { $CarPoolKeywords } from "CarPoolKeywords_registry";
import { KeywordUtils } from "KeywordUtils_lib";

let manufacturer = KeywordUtils.getViewValue($CarPoolKeywords.carManufacturer(), vars.get("$field.MANUFACTURER"));
let type = vars.get("$field.TYPE");

result.string(manufacturer + " " + type);

In the Navigator window, drag and drop the EntityFields MANUFACTURER and TYPE on the FieldGroup:

field_group_configuration

Now you can edit them in the CarPreviewCard ViewTemplate.