diff --git a/AyCode.Blazor.Components/docs/MGGRID/MGGRID_TODO.md b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_TODO.md index e0e84b8..d3a818e 100644 --- a/AyCode.Blazor.Components/docs/MGGRID/MGGRID_TODO.md +++ b/AyCode.Blazor.Components/docs/MGGRID/MGGRID_TODO.md @@ -13,6 +13,23 @@ For known issues / bugs see `MGGRID_ISSUES.md`. --- +## ACBLAZOR-GRID-T-K9F4: Sort the filter panel's lookup items (`OrderItemsByText`) +**Priority:** P2 · **Type:** Feature (framework-first) · **Origin:** 2026-07-17 user report (Id-ordered lookups are unusable — nothing is findable in the drop-down) · **Related:** design in `AyCode.Core/docs/adr/0004-signalr-datasource-server-side-filtering.md` → "Item ordering in the panel components" + +`DxTagBox` and its list-editor bases expose **no sort API** (verified against the DevExpress v25.1 XML docs) — DevExpress expects pre-sorted `Data`, so lookups currently render in whatever order the server returned (effectively by Id). + +Sorting in consumer markup (`Data="@Partners.OrderBy(p => p.Name)"`) is an **anti-pattern here and must not be used**: LINQ returns a NEW lazy wrapper on every render, while both DevExpress's `Data`-change detection and this component's snapshot tracker key on **references** → constant reload churn plus re-destabilized restore timing (the very race fixed in `MgGridFilterPanelTagBox`). + +Implement direction **(B)** from the ADR: `MgGridFilterPanelTagBox` gains `OrderItemsByText` (default `true`) + `OrderItemsDescending`, and hands DevExpress an **internal materialized list sorted by the `TextFieldName` value** (what the user actually reads and searches: Partner → name, Shipping → date), rebuilt **only** when the tracked source data actually changes. + +### Acceptance criteria +- The effective `Data` reference changes **exactly** when the source content changes — never per render (no churn). +- The empty→filled rebuild funnels into the existing delayed-assert safe order; the restore race does not regress (test: cold visit straight to a lookup-backed grid, chips restore). +- Sort key is the `TextFieldName` value via a cached accessor (no per-item reflection in the sort comparer); `OrderItemsDescending` flips it (e.g. newest shipping first). +- `OrderItemsByText="false"` leaves the consumer's `Data` order untouched. +- Zero consumer changes required; covers every fill path, including the grid-datasource pipeline that fills page-shared collections. +- Investigate (do NOT assume): whether the new-reference-on-fill makes the `Reload()` + `HealAssertDelayMs` heal redundant — if proven, remove it and note it in the ADR. + ## ACBLAZOR-GRID-T-W8Q3: `MgGridLayoutSave` envelope + pull-model filter-panel restore **Priority:** P1 · **Type:** Refactor (framework-first) · **Origin:** 2026-07-17 multi-agent restore-race audit · **Related:** `MGGRID_ISSUES.md#acblazor-grid-i-d4t7`; design in `AyCode.Core/docs/adr/0004-signalr-datasource-server-side-filtering.md` → "Planned v2"