v4.9.0-preview.0
Pre-releaseThis preview release includes early previews for new functionality, including support for multiple data models in the same task and support for sub-forms via the new Subform
component.
IMPORTANT: We've released a newer version with bugfixes (v4.9.0-preview.1), prefer to use that instead.
Using this pre-release
In your app, open App/views/Home/Index.cshtml
and change the two lines referring to the frontend version. Make them point to the pre-release:
- <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4/altinn-app-frontend.css">
- <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4/altinn-app-frontend.js"></script>
+ <link rel="stylesheet" type="text/css" href="https://altinncdn.no/toolkits/altinn-app-frontend/4.9.0-preview.1/altinn-app-frontend.css">
+ <script src="https://altinncdn.no/toolkits/altinn-app-frontend/4.9.0-preview.1/altinn-app-frontend.js"></script>
Also change your App.csproj
file to use the latest backend preview release, v8.5.0-preview.1
Support for multiple data models in the same task
In short, this allows you to set up multiple data models, all of which needs to have a taskId
property in applicationmetadata.json
. When multiple data models have been added, you can refer to another data model component configurations by changing the value(s) in dataModelBindings
to point to your data model:
{
"id": "my-component",
"type": "Input",
"dataModelBindings": {
"simpleBinding": {
"dataType": "someDataType",
"field": "Path.Inside.DataModel"
}
}
}
Additionally, if you want to look up values in other data models in dynamic expressions, you can do that by adding a second argument to the dataModel
function. For example, ["dataModel", "Path.Inside.DataModel", "someDataType"]
will look up the path in the someDataType
model instead of the default model.
If the data model binding is not specifying any data model, we use the default model for the current layout-set as configured in layout-sets.json
.
Support for subforms
In order to set up a subform, please refer to the documentation here.
What's missing in this preview
Some functionality is still a work in progress and subject to change, including:
- Better support for automatic PDF generation when including one or more subforms (when referred to in Summary2)
- Making it possible to generate one PDF per subform, including support for naming these files differently per subform
- Proper validation and feedback to the user when attempting to submit the main form while there are validation errors in a subform (subforms can already be validated when using a CustomButton to go back to the main form)