Update MgGrid reload logic, add IsProd env flag, doc fixes

- MgGridBase: call Reload after item changes to refresh grid view
- Add IsProd environment flag (FruitBankConst, IFruitBankDataControllerCommon, SignalRTags, client/server wiring)
- Logger DI: fix constructor param, default AppType to Web in configs and DI setup
- Docs: clarify MgGrid edit flow, editor requirements, companion component structure, and disposal logic
- Add PowerShell test command for EkaerTradeCardValidatorTests
This commit is contained in:
Loretta 2026-07-12 14:32:05 +02:00
parent a254dbe722
commit 9a0c077f2a
5 changed files with 27 additions and 40 deletions

View File

@ -432,7 +432,9 @@ public abstract class MgGridBase<TSignalRDataSource, TDataItem, TId, TLoggerClie
if (!changedEventArgs.CancelStateChangeInvoke && !_isDisposed) if (!changedEventArgs.CancelStateChangeInvoke && !_isDisposed)
{ {
await InvokeAsync(StateHasChanged); // Item changes are applied in place (CopyTo) — no collection notification fires, so the grid's
// processed view (sort/filter/page) would go stale; Reload re-processes it from the local data.
await InvokeAsync(Reload);
} }
} }

View File

@ -11,18 +11,7 @@ Blazor Razor component library targeting .NET 10. Provides reusable DevExpress-b
## Documentation ## Documentation
| Document | Topic | `docs/MGGRID/` — the MgGrid system (overview, parameters, CRUD/edit flow, layout persistence + server roaming, master-detail, rendering, InfoPanel, toolbar, columns, data source). Entry point: `docs/MGGRID/README.md` — its table indexes every sub-file.
|---|---|
| `MGGRID/README.md` | MgGrid system — overview, hierarchy, generic params, IMgGridBase interface |
| `MGGRID/MGGRID_PARAMETERS.md` | Component parameters, event callbacks, default grid settings |
| `MGGRID/MGGRID_CRUD.md` | Lifecycle, CRUD operations, edit flow, disposal |
| `MGGRID/MGGRID_LAYOUT.md` | Layout persistence (storage keys, tiers, operations) |
| `MGGRID/MGGRID_DETAIL.md` | Master-detail hierarchy |
| `MGGRID/MGGRID_RENDERING.md` | Fullscreen mode, rendering |
| `MGGRID/MGGRID_INFOPANEL.md` | MgGridInfoPanel, MgGridWithInfoPanel wrapper |
| `MGGRID/MGGRID_TOOLBAR.md` | MgGridToolbarTemplate (buttons, parameters, state) |
| `MGGRID/MGGRID_COLUMNS.md` | MgGridDataColumn (InfoPanel params, UrlLink) |
| `MGGRID/MGGRID_DATASOURCE.md` | MgGridSignalRDataSource (server-side data, local cache) |
## Dependencies ## Dependencies

View File

@ -69,18 +69,29 @@ New items get **temporary client-side IDs** until the server assigns real ones:
``` ```
User clicks Edit → OnEditStart → OnCustomizeEditModel User clicks Edit → OnEditStart → OnCustomizeEditModel
├── Set GridEditState = New/Edit
├── For new items: assign temp ID, set parent FK if detail grid ├── For new items: assign temp ID, set parent FK if detail grid
├── Notify InfoPanel: SetEditMode() ├── Set GridEditState = New/Edit
└── Fire OnGridCustomizeEditModel callback ├── Fire OnGridCustomizeEditModel callback
├── Re-read the edit model after the callback — the consumer may have created/replaced it
│ (official DevExpress pattern for types without a parameterless ctor); any instance the
│ pre-callback block has not seen gets the same temp-ID/parent-FK initialization
└── Notify InfoPanel: SetEditMode() — skipped with a Logger.Warning when no edit model exists
(e.g. stale focused row after a datasource reload; see MGGRID_ISSUES.md#acblazor-grid-i-n7k2)
User clicks Save → OnItemSaving User clicks Save → OnItemSaving
├── Fire OnGridEditModelSaving callback (can cancel) ├── Fire OnGridEditModelSaving callback (can cancel)
├── If new: AddDataItemAsync / InsertDataItemAsync ├── If new: AddDataItemAsync / InsertDataItemAsync — the local add is immediate; the row appears
│ at the sort position of its temp ID until the server confirms
├── If existing: UpdateDataItemAsync ├── If existing: UpdateDataItemAsync
├── Reset GridEditState = None ├── Reset GridEditState = None
└── Clear InfoPanel edit mode └── Clear InfoPanel edit mode
Server confirm (async, per item) → OnDataSourceItemChanged
├── The response is applied to the SAME instance in place (CopyTo — external references stay
│ valid; no collection notification fires)
└── Grid.Reload() re-processes the local view (sort/filter/page) — a new row jumps to its final
sorted position (real ID) without a data re-query
User clicks Cancel → OnEditCanceling User clicks Cancel → OnEditCanceling
├── Reset GridEditState = None ├── Reset GridEditState = None
└── Clear InfoPanel edit mode └── Clear InfoPanel edit mode
@ -92,10 +103,6 @@ When `GridEditState != None`, the focused row and its cells get `background-colo
## Disposal ## Disposal
`DisposeAsync()` handles cleanup: `DisposeAsync()`: sets `_isDisposed = true` (every async callback checks it and bails), unsubscribes the
1. Set `_isDisposed = true` (guards all async callbacks) three datasource events (`OnDataSourceLoaded`, `OnDataSourceItemChanged`, `OnSyncingStateChanged`) and
2. Unsubscribe from `OnDataSourceLoaded`, `OnDataSourceItemChanged`, `OnSyncingStateChanged` `OnCustomizeElement`, then `GC.SuppressFinalize(this)`.
3. Remove `OnCustomizeElement` handler
4. `GC.SuppressFinalize(this)`
All async callbacks check `_isDisposed` before proceeding.

View File

@ -83,11 +83,9 @@ stays in view mode (see `MGGRID_ISSUES.md#acblazor-grid-i-n7k2`).
### Edit Mode Editors ### Edit Mode Editors
Edit mode reads/writes properties via reflection and **assumes non-throwing accessors** — computed Edit mode reads/writes properties via reflection and **assumes non-throwing accessors**: columns whose
properties (e.g. GenericAttribute-backed getters that fail on edit-model copies, or deliberately getter/setter can throw (computed / GenericAttribute-backed members) MUST be declared `ReadOnly`, or the
throwing setters) MUST be declared `ReadOnly` on the column, otherwise rendering the editor crashes. editor render crashes — by design (fail-fast): a missing `ReadOnly` is a consumer bug to surface in dev, not to mask.
This is by design (fail-fast): the missing `ReadOnly` declaration is a consumer bug that should surface
in development, not be masked by silent fallbacks.
Editor resolution order: **column `InfoPanelEditTemplate` first** (`MgGridDataColumn` — see `MGGRID_COLUMNS.md`), Editor resolution order: **column `InfoPanelEditTemplate` first** (`MgGridDataColumn` — see `MGGRID_COLUMNS.md`),
then `EditSettings` (`DxComboBoxSettings`, `Memo`), then property type: then `EditSettings` (`DxComboBoxSettings`, `Memo`), then property type:

View File

@ -25,7 +25,7 @@
| `MGGRID_DETAIL.md` | Master-detail hierarchy | | `MGGRID_DETAIL.md` | Master-detail hierarchy |
| `MGGRID_RENDERING.md` | Fullscreen mode, rendering | | `MGGRID_RENDERING.md` | Fullscreen mode, rendering |
| `MGGRID_INFOPANEL.md` | MgGridInfoPanel, MgGridWithInfoPanel wrapper, responsive layout, templates, editors | | `MGGRID_INFOPANEL.md` | MgGridInfoPanel, MgGridWithInfoPanel wrapper, responsive layout, templates, editors |
| `MGGRID_TOOLBAR.md` | MgGridToolbarTemplate (buttons, parameters, state) | | `MGGRID_TOOLBAR.md` | MgGridToolbarBase, MgGridToolbarTemplate (buttons, parameters, state) |
| `MGGRID_COLUMNS.md` | MgGridDataColumn (InfoPanel params, UrlLink) | | `MGGRID_COLUMNS.md` | MgGridDataColumn (InfoPanel params, UrlLink) |
| `MGGRID_DATASOURCE.md` | MgGridSignalRDataSource (server-side data, local cache, background refresh) | | `MGGRID_DATASOURCE.md` | MgGridSignalRDataSource (server-side data, local cache, background refresh) |
| `MGGRID_ISSUES.md` | Known issues (`ACBLAZOR-GRID-I-*`, `ACBLAZOR-GRID-B-*`) | | `MGGRID_ISSUES.md` | Known issues (`ACBLAZOR-GRID-I-*`, `ACBLAZOR-GRID-B-*`) |
@ -40,16 +40,7 @@ DxGrid (DevExpress)
└── [Concrete entity grid] ← consumer sets CRUD tags in constructor └── [Concrete entity grid] ← consumer sets CRUD tags in constructor
``` ```
### Companion Components Companion components (wrapper, toolbars, column, InfoPanel, data source) are named in the table above; per-file source summaries: `Components/Grids/README.md`.
| Component | Purpose | Docs |
|---|---|---|
| **MgGridWithInfoPanel** | `DxSplitter` wrapper: grid + InfoPanel, fullscreen, splitter persistence | `MGGRID_INFOPANEL.md` |
| **MgGridToolbarBase** | `DxToolbar` base with `Grid` reference, `RefreshClick` callback | `MGGRID_TOOLBAR.md` |
| **MgGridToolbarTemplate** | Full toolbar: CRUD, navigation, layout menu, fullscreen, export | `MGGRID_TOOLBAR.md` |
| **MgGridDataColumn** | Extended `DxGridDataColumn` with InfoPanel params and `UrlLink` | `MGGRID_COLUMNS.md` |
| **MgGridInfoPanel** | Default InfoPanel: column-value pairs, edit mode, typed editors | `MGGRID_INFOPANEL.md` |
| **MgGridSignalRDataSource** | `GridCustomDataSource` wrapper: server-side filter/sort/page, local cache | `MGGRID_DATASOURCE.md` |
## Generic Type Parameters ## Generic Type Parameters