Render repeated Freedom UI components
Display a dynamic list of repeated Freedom UI components using the Template list component in a Freedom UI page schema based on a template and specific conditions. For example, a list of AI Skills that are connected to Creatio.ai chat panel. This provides a seamless and scalable way to build Freedom UI lists dynamically based on runtime data, with minimal effort.
To render repeated Freedom UI components:
-
Implement the data source. For example, implement the data source that receives the AI Skill list from the
CopilotIntentobject schema.modelConfigDiff schema sectionmodelConfigDiff: /**SCHEMA_MODEL_CONFIG_DIFF*/[{"operation": "merge","path": ["dataSources"],"values": {"CopilotQuickActionsDS": {"type": "crt.EntityDataSource","scope": "viewElement","config": {"entitySchemaName": "CopilotIntent","attributes": {"Name": {"path": "Name"}}}}}}]/**SCHEMA_MODEL_CONFIG_DIFF*/ -
Add an attribute.
- Go to the
viewModelConfigDiffschema section →valuesconfiguration object. - Add an attribute that stores a list of elements to display. For this example,
CopilotQuickActions. The data source is theCopilotIntentschema whoseNamecolumn values are displayed as the titles of the Button component.
viewModelConfigDiff schema sectionviewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[{"operation": "merge","path": ["attributes"],"values": {...,"CopilotQuickActions": {"isCollection": true,"modelConfig": {"path": "CopilotQuickActionsDS"},"viewModelConfig": {"attributes": {"CopilotQuickActionsDS_Name": {"modelConfig": {"path": "CopilotQuickActionsDS.Name"}}}}}}}]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/ - Go to the
-
Set up rendering parameters.
-
Bind an attribute to the page element.
-
Go to the
viewConfigDiffschema section → corresponding page element →valuesconfiguration object whosetypeproperty is set tocrt.TemplateList. Learn more: Template list component. -
Bind the model attribute to the
itemsproperty. For this example,CopilotQuickActions.Since version 8.3.1, Freedom UI components that work with collections support bindings to attributes inside nested collections. For example, when a collection rendered in the template list includes a nested collection that is passed to the
itemsproperty of a Data grid component used as a template, bindings like$ParentCollection.NestedCollection.Idfor thecellViewandeditingCellViewproperties of the Data grid component work correctly.
-
-
Implement the
templatearray of objects to render repeated Freedom UI components. -
Implement the
classesarray of CSS classes to customize the appearance and layout of the Template list component.
viewConfigDiff schema sectionviewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[{"operation": "insert","name": "Conversation","values": {"type": "crt.TemplateList","items": "$CopilotQuickActions","direction": "row","gap": 32,"template": [{"type": "crt.Button","caption": "$CopilotQuickActions.CopilotQuickActionsDS_Name","size": "medium","clicked": {"request": "crt.CopilotActionRequest","params": {"prompt": "$CopilotQuickActions.CopilotQuickActionsDS_Name"}}}],"classes": ["copilot-actions-list"]},"parentName": "MainContainer","propertyName": "items","index": 0}]/**SCHEMA_VIEW_CONFIG_DIFF*/ -
As a result, Creatio will display a dynamic list of repeated Freedom UI components.
See also
Best practices for optimizing data fetching in Freedom UI page logic