Replies: 1 comment 1 reply
-
You can have custom component, for example Save button with cascading validations <Button Clicked="@Clicked" Color="Color.Primary">
@ChildContent
</Button>
@code {
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public EventCallback Clicked { get; set; }
[CascadingParameter] public Validations Validations { get; set; }
} and <SaveCommandTemplate>
<MyButton @ref="@myButton" Clicked="@SaveButton">@context.LocalizationString</MyButton>
</SaveCommandTemplate> and myButton.Validations.ValidateAll() |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
Really finding the datagrid useful and powerful. But I may be missing the best way to update row to the database on the Editrow.
Currently I am using the RowUpdating function to commit the update to the database, there are on occasions server side conditions that one wants to communicate back to the fields as errors in the columns in the datagrid for the row being edited.
Currently the SaveWithValidation function issues a validations.ValidateAll() before Save.InvokeAsync and then the RowUpdating callback is called.
Is there a way to trigger a validateall from RowUpdating callback, to refresh the errors in the event of a e.Cancel = true condition?
I have captured the commandContext from save and issue a ctx.Clicked.InvokeAsync() which causes a validateAll when there are error conditions from the database, an example may be a unique username was used by another user at the exact same time.
But I think I may be missing a better way?
Sanguinal
Beta Was this translation helpful? Give feedback.
All reactions