-
Notifications
You must be signed in to change notification settings - Fork 78
kb(Grid): prevent checkbox column click #3027
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
base: master
Are you sure you want to change the base?
Conversation
description: How to prevent an accidental click in the CheckBox column of the Grid | ||
type: how-to | ||
page_title: Grid CheckBox column prevent accidental click | ||
slug: grid-checkbox-column-prevent-click |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We normally use -kb-
in KB slugs to differentiate them.
slug: grid-checkbox-column-prevent-click | |
slug: grid-kb-checkbox-column-prevent-click |
private async Task OnRowClickHandler(GridRowClickEventArgs args) | ||
{ | ||
// call a function that will prevent deselection of already selected rows | ||
await JS.InvokeVoidAsync("handleDeselection"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic misses the first outside-the-checkbox click. Thus, attach the handler on initial component render and after rebind. The latter will be easier to achieve if using Grid OnRead
.
private async Task OnRowClickHandler(GridRowClickEventArgs args) | |
{ | |
// call a function that will prevent deselection of already selected rows | |
await JS.InvokeVoidAsync("handleDeselection"); | |
} | |
protected override async Task OnAfterRenderAsync(bool firstRender) | |
{ | |
if (firstRender) | |
{ | |
await Task.Delay(1); | |
await JS.InvokeVoidAsync("handleDeselection"); | |
} | |
await base.OnAfterRenderAsync(firstRender); | |
} |
Hello @dimodi, Check the below option if you would like to automatically generate PR to production. The automation uses the branch for the cherry-pick, and then will delete the branch. Please, do not delete it manually.
|
Note to external contributors: make sure to sign our Contribution License Agreement (CLA) for Blazor UI first:
https://forms.office.com/Pages/ResponsePage.aspx?id=Z2om2-DLJk2uGtBYH-A1NbWxVqugKN5DvVp8I-1AgOBURFBVSkwyMlA1TkFDVFdMNU1aM1o1UlZQOC4u