Ui5 Best Practices Mdc

by UI5a99b882ce364No licenseListed Oct 8, 2026Updated Oct 8, 2026

UI5 MDC (sap.ui.mdc) best practices for OData V4 delegate-based controls. Use when creating/troubleshooting MDC FilterBar, Chart, Field, FilterField, ValueHelp, Link, MultiValueField, or Table. Covers delegate pattern, fetchProperties, PropertyInfo, p13nMode, updateBindingInfo, Condition.createCondition, and common errors (delegate not loaded, chart no data, fields not appearing). Also applies to JSON model (non-OData) MDC usage. Triggers: "MDC", "sap.ui.mdc", "delegate pattern", "fetchProperties", "PropertyInfo", "MDC personalization", "p13nMode", "MDC field not rendering", "MDC chart not binding", "MDC conditions", OData V4 freestyle with model-driven controls. Keywords: sap.ui.mdc, FilterBar, Chart, Field, FilterField, ValueHelp, Link, MultiValueField, delegate, fetchProperties, updateBindingInfo, PropertyInfo, OData V4, JSON model, TypeMap, p13nMode, conditions, FilterBarDelegate, ChartDelegate, ValueHelpDelegate, LinkDelegate, Condition.createCondition

Instructions onlySoftware Development
AI-generated overview

Guidance for building and troubleshooting SAPUI5 MDC (sap.ui.mdc) controls with OData V4 or JSON delegates.

What it does
This skill supplies best-practice guidance for SAPUI5 MDC controls such as FilterBar, Chart, Field, FilterField, ValueHelp, Link, MultiValueField and Table. It explains the delegate pattern, PropertyInfo and fetchProperties, p13nMode personalization, condition creation, binding updates, and common error fixes. It also routes the agent to per-control reference documents before producing code.
When to use it
Use it when writing, reviewing or debugging freestyle SAPUI5 applications that use sap.ui.mdc controls against OData V4 services or JSON models. It is also relevant when diagnosing MDC issues such as delegates not loading, charts showing no data, or fields not rendering.
Requirements
No scripts are shipped; it is instructions plus reference markdown files. It assumes SAPUI5 1.136+ LTS and mentions optional MCP tools (get_api_reference, run_ui5_linter) for API verification and linting.

UI5 MDC Controls Best Practices

Apply these guidelines whenever generating, reviewing, or troubleshooting MDC control code in freestyle applications using OData V4 services.

UI5 version baseline: SAPUI5 1.136+ LTS. All features mentioned are available from this version unless noted.

When to load each reference

TriggerLoad
Working on or planning a sap.ui.mdc.FilterBarreferences/mdc-filter-bar.md [blocked]
Working on or planning a sap.ui.mdc.Chartreferences/mdc-chart.md [blocked]
Working on or planning a sap.ui.mdc.Fieldreferences/mdc-field.md [blocked]
Working on or planning a sap.ui.mdc.FilterFieldreferences/mdc-filter-field.md [blocked]
Working on or planning a sap.ui.mdc.ValueHelpreferences/mdc-value-help.md [blocked]
Working on or planning a sap.ui.mdc.Linkreferences/mdc-link.md [blocked]
Working on or planning a sap.ui.mdc.MultiValueFieldreferences/mdc-multi-value-field.md [blocked]
Using MDC controls with JSON model (non-OData)references/mdc-json-delegates.md [blocked]

Load before producing any output. Do not work from memory.


The Delegate Pattern

All MDC controls use a delegate to decouple the control from data-source-specific logic. App developers must:

  1. Specify the delegate in XML: delegate="{name: 'my/app/delegate/MyDelegate', payload: {entitySet: 'Products'}}"
  2. Implement the delegate module extending the appropriate base delegate
  3. Override key methods (at minimum fetchProperties)

Base delegates for OData V4:

ControlBase Delegate
Tablesap/ui/mdc/odata/v4/TableDelegate
FilterBarsap/ui/mdc/odata/v4/FilterBarDelegate
Chartsap/ui/mdc/odata/v4/vizChart/Delegate
ValueHelpsap/ui/mdc/ValueHelpDelegate
Linksap/ui/mdc/LinkDelegate
MultiValueFieldsap/ui/mdc/field/MultiValueFieldDelegate

JSON model usage: MDC controls also work with JSON models. Extend the base delegates directly (sap/ui/mdc/TableDelegate, sap/ui/mdc/FilterBarDelegate) — not the OData V4 variants. See references/mdc-json-delegates.md [blocked] for details.

PropertyInfo — the core metadata format returned by fetchProperties:

javascript
{    key: "propertyName",        // Unique identifier (required)    label: "Display Label",     // User-visible label (required)    dataType: "sap.ui.model.odata.v4.type.String"  // Data type (required)}

Core Rules

Mandatory

  • Every MDC control requires a delegate property pointing to a valid module path.
  • Implement fetchProperties in the delegate returning PropertyInfo[] with at minimum: key, label, dataType.
  • Extend the appropriate OData V4 base delegate (see table above) for OData V4 services. For JSON/other models, extend the generic base delegate directly.
  • Use p13nMode to enable personalization (Column, Sort, Filter, Group for Table; Item, Sort, Filter, Type for Chart; Item for FilterBar).
  • Use sap.ui.mdc.condition.Condition.createCondition() to construct conditions programmatically.
  • Use sap.ui.model.odata.v4.type.* types in PropertyInfo dataType field for OData V4 models. Use sap.ui.model.type.* with JSON models. Register types in the TypeMap.
  • Set ariaLabelledBy on FilterBar and Chart for accessibility.
  • Prefer Fiori elements building blocks over freestyle MDC. Use MDC only when Fiori elements is out of scope.
  • Use get_api_reference MCP tool to verify control APIs. Use run_ui5_linter to validate code.

Prohibitions

  • Do not use MDC controls with OData V2 models. Use Smart controls (sap.ui.comp) instead. MDC works with OData V4 and JSON models.
  • Do not access inner controls directly (e.g., inner sap.chart.Chart or sap.m.Table). Use the delegate or MDC control's public API.
  • Do not omit key from PropertyInfo objects (formerly name, now deprecated).
  • Do not construct condition objects manually as plain JSON. Always use Condition.createCondition(operator, values).
  • Do not skip delegate implementation for production code (built-in defaults are for demos only).
  • Do not use inline styles or scripts (CSP compliance).
  • Do not use global access (sap.ui.mdc.FilterBar). Use sap.ui.define or ES6 imports.

Selection Matrix

ControlUse whenDo not use when
MDC FilterBarOData V4 or JSON model, delegate-driven filter UI, MDC Table/ChartOData V2 (use SmartFilterBar), simple search bar
MDC ChartOData V4, delegate-driven chart visualization, drill-downOData V2 (use SmartChart), simple static charts, no analytical data
MDC FieldOData V4 or JSON, single field with auto-rendering by data typeOData V2 (use SmartField), purely custom rendering needed
MDC FilterFieldInside MDC FilterBar for individual filter conditionsStandalone filtering outside FilterBar context
MDC ValueHelpOData V4 or JSON, type-ahead + dialog value selectionOData V2 (use ValueHelpDialog), simple dropdowns without search
MDC LinkOData V4, semantic object navigation, delegate-driven link targetsOData V2 (use SmartLink), simple static links
MDC MultiValueFieldOData V4 or JSON, multi-value token entry via items aggregationOData V2 (use SmartMultiInput), simple single-value fields

Common Errors

SymptomCauseFix
"Delegate module could not be loaded"Wrong path in delegate propertyVerify module path matches actual file location in project.
Chart shows no datafetchProperties returns wrong PropertyInfo (missing groupable/aggregatable)Ensure dimensions have groupable: true, measures have aggregatable: true.
FilterBar fields not appearingPropertyInfo missing or hiddenFilter: trueCheck delegate fetchProperties returns properties with correct visibility.
Field shows wrong inner controldataType in PropertyInfo doesn't match expected formatVerify dataType uses full qualified type name (e.g., sap.ui.model.odata.v4.type.String).
Personalization dialog emptyp13nMode not set or PropertyInfo incompleteAdd p13nMode="Column,Sort,Filter" and ensure PropertyInfo has sortable/filterable flags.
ValueHelp not openingValueHelp not connected to Field or containers missingVerify valueHelp association on Field and that Popover/Dialog containers are defined.
Conditions not applied to bindingupdateBindingInfo not implemented in delegateImplement updateBindingInfo to apply filter conditions to the OData binding.
Link always rendered as textfetchLinkType returns LinkType.Text or failsImplement fetchLinkType returning Popup or DirectLink type.

Performance & Accessibility

Anti-patterns to avoid

  • Loading all PropertyInfo eagerly when only a subset is needed (return minimal set from fetchProperties).
  • Not implementing updateBindingInfo (conditions are never applied to the data binding).
  • Skipping p13nMode configuration (personalization features are disabled by default).
  • Creating large delegate modules (split complex logic into helper modules loaded on demand).
  • Using synchronous operations in delegate methods (all delegate methods should return Promises).

Accessibility checklist

  • Set ariaLabelledBy on FilterBar referencing a visible title.
  • Set ariaLabelledBy on Chart referencing a visible title.
  • Verify keyboard navigation works for personalization dialogs.
  • Test ValueHelp type-ahead and dialog with screen reader.
  • Ensure all FilterFields have meaningful labels via PropertyInfo label.

Source and attribution

Source:UI5/plugins-coding-agentsinplugins/ui5/skills/ui5-best-practices-mdcat commita99b882

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal