UI5 Table Best Practices
Apply these guidelines whenever generating, reviewing, or troubleshooting UI5 table code in freestyle applications.
UI5 version baseline: SAPUI5 1.136+ LTS. All features mentioned are available from this version unless noted.
When to load each reference
Load before producing any output. Do not work from memory.
Core Rules
Mandatory
- Choose the table type using the Selection Matrix before writing any code.
- Use the
rowsaggregation forsap.ui.table.*anditemsforsap.m.Table. Never swap them. - Use
sap.m.p13n.Enginefor personalization. Never build custom personalization dialogs. - Set
ariaLabelledByon every table, referencing the table title control. - Align cell content by data type: numbers and dates right (
hAlign="End"), text and links left. - Use appropriate cell templates:
sap.m.Textfor display,sap.m.ObjectNumberfor numbers,sap.m.Linkfor navigation. - Request
$count=truefrom the back end forsap.ui.table.*when a total count is required. - Use the
rowModeaggregation (not the deprecatedvisibleRowCountModeproperty) forsap.ui.table.*(UI5 1.119+).
Prohibitions
- Do not use global variables. Use
sap.ui.defineAMD modules or ES6 imports. - Do not enable text wrapping in
sap.ui.table.*cells — it breaks virtualization. - Do not assume
sap.ui.export.Spreadsheetis available. Detect the library before use. - Do not use
sap.ui.table.Tablefor mobile-first scenarios. Usesap.m.Table. - Do not use
sap.m.Tablefor datasets with 1000+ rows that require virtualization. - Do not place multiple interactive elements in one
sap.ui.table.Tablecell. - Do not return enum objects from formatters. Return string literals or primitive values.
- Do not use formatters for
ColumnListItemhighlight. Use direct data binding. - Do not access models without checking availability — causes "Cannot read properties of undefined".
- Do not mix type namespaces: never use
sap.ui.model.odata.type.*with a JSON model, orsap.ui.model.type.*with OData.
OData V4 policy
Prefer SAP Fiori elements building blocks over freestyle tables for OData V4. Use sap.ui.mdc.Table only when Fiori elements is out of scope.
Selection Matrix
Dataset size guide
Common Errors
Container Structures
Valid
Invalid (and why)
Performance & Accessibility
Anti-patterns to avoid
- Handcrafted personalization dialogs (use
sap.m.p13n.Engine). - Text wrapping in
sap.ui.table.Tablecells. - Multiple interactive elements in one GridTable cell.
- Mixing OData V2
SmartTablewith V4 services. - Deep nesting in cell templates.
- Fixed
thresholdwithout load testing. - Unconditional
$count=true(request count only when needed).
Accessibility checklist
- Set
ariaLabelledByon every table, referencing the visible title. - Use
sap.m.Text(not raw text nodes) as cell templates. - For
sap.ui.table.Table: test keyboard navigation (Tab, arrow keys, Space/Enter for selection). - Verify that the personalization dialog is keyboard-operable.
- Test with a screen reader (NVDA/JAWS on Windows, VoiceOver on macOS) before shipping.


