Fix Table Row Mode

作者 UI52b8c4a944e39無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Fix deprecated `sap.ui.table.Table` row properties that UI5 linter reports but cannot auto-fix. Use this skill when linter outputs: - `no-deprecated-api` with messages about `visibleRowCountMode`, `visibleRowCount`, `rowHeight`, `fixedRowCount`, `fixedBottomRowCount`, or `minAutoRowCount` Trigger on: deprecated row-related properties on sap.ui.table.Table in JS or XML, modernization to rowMode aggregation. Converts deprecated flat properties to a structured `rowMode` aggregation using `sap.ui.table.rowmodes.Fixed`, `Interactive`, or `Auto`.

AI 產生的概覽

將已棄用的 sap.ui.table.Table 列屬性轉換為 rowMode 聚合,修復 UI5 程式碼。

功能
此技能指導對 sap.ui.table.Table 上已棄用列相關屬性的現代化改造,這些屬性會被 UI5 linter 回報但無法自動修復。它把 visibleRowCountMode、visibleRowCount、rowHeight、fixedRowCount、fixedBottomRowCount 和 minAutoRowCount 等扁平屬性對應到結構化的 rowMode 聚合,使用 sap.ui.table.rowmodes.Fixed、Interactive 或 Auto。它提供 XML 檢視和 JavaScript 的前後對照範例,包括以 setter 為基礎的寫法,並包含安全檢查:當屬性與所選 RowMode 類別不相容時中止改造。
適用情境
當 UI5 linter 輸出針對 JavaScript 或 XML 中 sap.ui.table.Table 已棄用列屬性的 no-deprecated-api 訊息時使用。它用於將這些表格現代化為 rowMode 聚合,而不是把 sap.ui.table.Table 遷移為 sap.m.Table。
執行需求
無指令碼,僅為說明。代理需要存取受影響的 UI5 專案檔案,並使用 UI5 linter 來識別和驗證受影響的 Table 實例。

Fix Table Row Mode (no-deprecated-api)

This skill fixes deprecated row-related properties on sap.ui.table.Table that the UI5 linter detects but cannot auto-fix. The modernization replaces flat properties with a structured rowMode aggregation.

IMPORTANT: Do NOT modernize sap.ui.table.Table to sap.m.Table — they are not equivalent.

Linter Rule

Rule IDMessage Pattern
no-deprecated-apiUse of deprecated property 'visibleRowCountMode' of class 'sap.ui.table.Table'
no-deprecated-apiUse of deprecated property 'visibleRowCount' of class 'sap.ui.table.Table'
no-deprecated-apiUse of deprecated property 'rowHeight' of class 'sap.ui.table.Table'
no-deprecated-apiUse of deprecated property 'fixedRowCount' of class 'sap.ui.table.Table'
no-deprecated-apiUse of deprecated property 'fixedBottomRowCount' of class 'sap.ui.table.Table'
no-deprecated-apiUse of deprecated property 'minAutoRowCount' of class 'sap.ui.table.Table'

Property Mapping

Deprecated Property on TableNew Property on RowModeNotes
visibleRowCountMode(Determines RowMode class)"Fixed" → rowmodes:Fixed, "Interactive" → rowmodes:Interactive, "Auto" → rowmodes:Auto
visibleRowCountrowCountUsed in Fixed and Interactive mode
minAutoRowCountminRowCountUsed only in Auto mode
rowHeightrowContentHeightName change
fixedRowCountfixedTopRowCountName change (Top added)
fixedBottomRowCountfixedBottomRowCountNo change

RowMode Class Selection

Choose based on the old visibleRowCountMode value:

  • "Fixed" (or not set — this is the default) → rowmodes:Fixed
  • "Interactive" → rowmodes:Interactive
  • "Auto" → rowmodes:Auto

Pre-Modernization Safety Check

If a property set on the Table doesn't exist on the selected RowMode class (e.g., minAutoRowCount on a Fixed mode table), this indicates possible dynamic row mode switching. Abort modernization for that table and flag for manual review.

Fix Strategy — XML Views

Step 1: Add XML Namespace

Add to the root <mvc:View> tag:

xml
xmlns:rowmodes="sap.ui.table.rowmodes"

Step 2: Remove Deprecated Properties and Add rowMode Aggregation

Before (Fixed mode):

xml
<table:Table    rows="{/Products}"    visibleRowCountMode="Fixed"    visibleRowCount="5"    fixedRowCount="1"    fixedBottomRowCount="2"    rowHeight="30">    <table:columns>...</table:columns></table:Table>

After:

xml
<table:Table    rows="{/Products}">    <table:rowMode>        <rowmodes:Fixed            rowCount="5"            fixedTopRowCount="1"            fixedBottomRowCount="2"            rowContentHeight="30"/>    </table:rowMode>    <table:columns>...</table:columns></table:Table>

Before (Interactive mode):

xml
<table:Table    rows="{/Products}"    visibleRowCountMode="Interactive"    visibleRowCount="10"    rowHeight="25">

After:

xml
<table:Table    rows="{/Products}">    <table:rowMode>        <rowmodes:Interactive            rowCount="10"            rowContentHeight="25"/>    </table:rowMode>

Before (Auto mode):

xml
<table:Table    rows="{/Items}"    visibleRowCountMode="Auto"    minAutoRowCount="3">

After:

xml
<table:Table    rows="{/Items}">    <table:rowMode>        <rowmodes:Auto minRowCount="3"/>    </table:rowMode>

Fix Strategy — JavaScript

Step 1: Add RowMode Import

Add the appropriate class to sap.ui.define:

  • "sap/ui/table/rowmodes/Fixed" for Fixed mode
  • "sap/ui/table/rowmodes/Interactive" for Interactive mode
  • "sap/ui/table/rowmodes/Auto" for Auto mode

Step 2: Replace Properties with rowMode

Before:

javascript
sap.ui.define([    "sap/ui/table/Table"], function(Table) {    var oTable = new Table({        visibleRowCountMode: "Interactive",        visibleRowCount: 10,        rowHeight: 25    });});

After:

javascript
sap.ui.define([    "sap/ui/table/Table",    "sap/ui/table/rowmodes/Interactive"], function(Table, InteractiveRowMode) {    var oTable = new Table({        rowMode: new InteractiveRowMode({            rowCount: 10,            rowContentHeight: 25        })    });});

Also handle setter-based patterns:

Before:

javascript
oTable.setVisibleRowCountMode("Fixed");oTable.setVisibleRowCount(8);oTable.setFixedRowCount(2);oTable.setRowHeight(40);

After:

javascript
// Import: "sap/ui/table/rowmodes/Fixed"oTable.setRowMode(new FixedRowMode({    rowCount: 8,    fixedTopRowCount: 2,    rowContentHeight: 40}));

Implementation Steps

  1. Run linter with --details to identify all affected Table instances
  2. For each Table, determine the RowMode class from visibleRowCountMode (default: "Fixed")
  3. Safety check: Verify all deprecated properties are compatible with the chosen RowMode class
  4. XML views: Add xmlns:rowmodes="sap.ui.table.rowmodes" namespace, remove deprecated properties, add <rowMode> aggregation
  5. JavaScript: Add RowMode import, create RowMode instance with mapped properties, set via constructor or setRowMode()
  6. Verify by re-running the linter

RowMode Properties Reference

ModeAvailable Properties
FixedrowCount, fixedTopRowCount, fixedBottomRowCount, rowContentHeight
InteractiverowCount, rowContentHeight
AutominRowCount, fixedTopRowCount, fixedBottomRowCount, rowContentHeight

Notes

  • If visibleRowCountMode is not set, the default was "Fixed" — use rowmodes:Fixed
  • The <table:rowMode> aggregation goes inside <table:Table>, alongside <table:columns>
  • In XML, always use the rowmodes: namespace prefix for RowMode elements
  • Both old and new APIs are synchronous — no async handling needed

Related Skills

  • fix-deprecated-controls: For other no-deprecated-api errors on sap.ui.table.Table (e.g., deprecated classes, properties not related to row mode), use fix-deprecated-controls
  • fix-js-globals: If the Table is instantiated via global access (e.g., new sap.ui.table.Table()), fix-js-globals handles converting to proper module imports

來源與署名

來源:UI5/plugins-coding-agents位於plugins/ui5-modernization/skills/fix-table-row-mode提交2b8c4a9

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架