Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ValidationsSummaryErrors to DataGrid #2091

Closed
DDDenisSobek opened this issue Mar 24, 2021 · 2 comments
Closed

Add ValidationsSummaryErrors to DataGrid #2091

DDDenisSobek opened this issue Mar 24, 2021 · 2 comments
Milestone

Comments

@DDDenisSobek
Copy link
Contributor

Is your feature request related to a problem? Please describe.
If exceptions happens at updating, adding or deleting of item, I want to show these for the user and want to cancel updating.

Describe the solution you'd like
I would like, that i can write my error text and state in CancellableRowChange, so that it be shown in pop up window and in form of DataGrid.

<DataGrid ... RowUpdating="@Updating">
...
</DataGrid>
@{
  public void Updating(CancellableRowChange<...> args)
  {
    try
    {
    ...
    }
    catch(Exception ex)
    {
      args.ErrorText = ... ;
      args.Status = ValidationStatus.Error;
      args.Cancel = true;
    }
  }
}
@stsrki
Copy link
Collaborator

stsrki commented Mar 24, 2021

While I can agree it is a good feature maybe it's better to expand on the existing implementation. For example, we currently have these parameters on DataGrid

/// <summary>
/// If true, shows feedbacks for all validations.
/// </summary>
[Parameter] public bool ShowValidationFeedback { get; set; } = false;

/// <summary>
/// If true, shows summary for all validations.
/// </summary>
[Parameter] public bool ShowValidationsSummary { get; set; } = true;

/// <summary>
/// Label for validaitons summary.
/// </summary>
[Parameter] public string ValidationsSummaryLabel { get; set; }

And I can add additional

[Parameter] public string[] ValidationsSummaryErrors { get; set; }

that could be used like

<DataGrid ... RowUpdating="@Updating" ValidationsSummaryErrors="@errors">
...
</DataGrid>
@{
  string[] errors;

  public void Updating(CancellableRowChange<...> args)
  {
    errors = null;

    try
    {
    ...
    }
    catch(Exception ex)
    {
      errors = new string[]{ something};
      args.Cancel = true;
    }
  }
}

@DDDenisSobek
Copy link
Contributor Author

Yea, this would be ok for me.

@stsrki stsrki added this to the 0.9.4 milestone Mar 24, 2021
@stsrki stsrki changed the title Error handling at updating/adding/deleting in DataGrid Add ValidationsSummaryErrors to DataGrid Mar 24, 2021
This was referenced Mar 25, 2021
@stsrki stsrki closed this as completed Mar 25, 2021
@stsrki stsrki moved this to ✔ Done in Development Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants