MessageList
Groups messages by severity and can focus the field connected to an entry.
When to use
- Collect validation results from several fields in one place.
Examples
A short message list
Loading the example
<k:MessageList press=".onSelect">
<k:MessageItem state="Error" title="Postcode required"/>
<k:MessageItem state="Information" title="Pickup also available"/>
</k:MessageList>sap.ui.define(["sap/ui/core/mvc/Controller", "kor/ui/Toast"], (Controller, Toast) => Controller.extend("sample.MessageSummary", {
onSelect(event) {
Toast.show(event.getParameter("item").getTitle());
}
}));Jump to the invalid field
Select the message to focus the input. Set target to the field’s full UI5 ID.
Loading the example
<k:Stack gap="10">
<k:MessageList press=".onSelect">
<k:MessageItem id="postcodeMessage" state="Error" title="Postcode missing" text="Complete the dispatch address."/>
</k:MessageList>
<k:TextField id="postcode" label="Postcode" error="Enter the postcode."/>
</k:Stack>sap.ui.define(["sap/ui/core/mvc/Controller", "kor/ui/Toast"], (Controller, Toast) => Controller.extend("sample.DispatchMessages", {
onInit() {
this.byId("postcodeMessage").setTarget(this.byId("postcode").getId());
},
onSelect(event) {
Toast.show(event.getParameter("item").getTitle());
}
}));API
Aggregations
| Name | Type | Description |
|---|---|---|
items | MessageItem[] | Message entries |
Events
| Name | Type | Description |
|---|---|---|
press | item: kor.ui.MessageItem | A message was pressed. Its target, if available, has received focus |
MessageItem
An entry in a message list.
Properties
| Name | Type | Default | Description |
|---|---|---|---|
state | string | info | Severity or UI5 message type |
title | string | Heading | |
text | string | Description | |
target | string | ID of the corresponding field |