Sync date filter UI with criteria; restore dropdown footer
Add _filterContexts to track filter menu contexts per field and update their FilterCriteria when criteria change, ensuring the date filter UI stays in sync. Remove CSS that hid the native Apply/Clear footer in the date filter dropdown.
This commit is contained in:
@@ -33,6 +33,7 @@ public abstract class BandGridBase<TItem> : ComponentBase
|
||||
private readonly Dictionary<string, EventCallback<DateTime?>> _fromCallbacks = new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly Dictionary<string, EventCallback<DateTime?>> _toCallbacks = new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly Dictionary<string, RenderFragment<GridDataColumnFilterMenuTemplateContext>> _dateFilterTemplates = new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly Dictionary<string, GridDataColumnFilterMenuTemplateContext> _filterContexts = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
// --- SizeMode ---
|
||||
protected SizeMode _sizeMode = SizeMode.Medium;
|
||||
@@ -253,8 +254,9 @@ public abstract class BandGridBase<TItem> : ComponentBase
|
||||
}
|
||||
|
||||
private RenderFragment<GridDataColumnFilterMenuTemplateContext> BuildDateFilterTemplate(string fieldName) =>
|
||||
_ => b =>
|
||||
ctx => b =>
|
||||
{
|
||||
_filterContexts[fieldName] = ctx;
|
||||
int s = 0;
|
||||
b.OpenElement(s++, "div");
|
||||
b.AddAttribute(s++, "class", "date-filter-menu p-2");
|
||||
@@ -322,6 +324,8 @@ public abstract class BandGridBase<TItem> : ComponentBase
|
||||
};
|
||||
|
||||
gridRef?.SetFieldFilterCriteria(fieldName, criteria);
|
||||
if (_filterContexts.TryGetValue(fieldName, out var ctx))
|
||||
ctx.FilterCriteria = criteria;
|
||||
_ = InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -294,10 +294,4 @@ html.dx-dark .dxbl-grid > .dxbl-grid-top-panel {
|
||||
|
||||
.top-row .btn-gap {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
/* Date-Filter: nativer Apply/Clear-Footer ausblenden, da Filter sofort bei Datumsauswahl angewendet wird */
|
||||
/* .dxbl-dropdown-footer ist der korrekte Selektor für das Filter-Dropdown (nicht .dxbl-popup-buttons-area, das ist für modale Popups) */
|
||||
.dxbl-filter-menu-dropdown-root:has(.date-filter-menu) .dxbl-dropdown-footer {
|
||||
display: none !important;
|
||||
}
|
||||
Reference in New Issue
Block a user