Refactor MassDataGrid editing and validation logic
- Switch to custom edit model (MassDataEditModel) for popup editing, enabling granular field validation and UI control - Replace default editors with explicit DxTextBox/DxCheckBox bindings - Add AmountText field for string input and validation; validate and convert in OnEditModelSaving - Implement duplicate customer check via new GetByCustomerNameAsync API method - Show ValidationSummary in popup; manage validation state with ValidationMessageStore and EditContext - Make popup header and width dynamic; show procedure ComboBox only for existing records - Restore "New" button in grid command column - Refactor CatalogsGrid to handle validation clearing in OnEditFieldChanged instead of OnTitleChanged - General improvements to real-time validation feedback
This commit is contained in:
@@ -97,10 +97,7 @@ else
|
||||
@{ SetEditContext(editFormContext.EditContext); var editModel = (CatalogEditModel)editFormContext.EditModel; SetPopupHeaderText(editModel.IsNew); }
|
||||
<DxFormLayout ColCount="2">
|
||||
<DxFormLayoutItem Caption="Titel">
|
||||
<DxTextBox @bind-Text="editModel.CatTitle"
|
||||
@bind-Text:after="OnTitleChanged"
|
||||
BindValueMode="BindValueMode.OnInput"
|
||||
Width="100%" />
|
||||
<DxTextBox @bind-Text="editModel.CatTitle" Width="100%" />
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Kennung">
|
||||
<DxTextBox @bind-Text="editModel.CatString" Width="100%" />
|
||||
@@ -174,19 +171,15 @@ else
|
||||
{
|
||||
validationMessageStore.Clear();
|
||||
editContext.NotifyValidationStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTitleChanged()
|
||||
{
|
||||
if (validationMessageStore == null || editContext == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var field = new FieldIdentifier(editContext.Model, nameof(CatalogEditModel.CatTitle));
|
||||
validationMessageStore.Clear(field);
|
||||
editContext.NotifyValidationStateChanged();
|
||||
if (e.FieldIdentifier.FieldName == nameof(CatalogEditModel.CatTitle))
|
||||
{
|
||||
var field = new FieldIdentifier(editContext.Model, nameof(CatalogEditModel.CatTitle));
|
||||
validationMessageStore.Clear(field);
|
||||
editContext.NotifyValidationStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetPopupHeaderText(bool isNew)
|
||||
|
||||
Reference in New Issue
Block a user