Unplanned
Last Updated: 22 Jan 2025 08:35 by Ron
Wei
Created on: 14 Jun 2021 14:42
Category: Grid
Type: Bug Report
17
OnChange and OnBlur events do not fire for some editors in InCell edit mode

OnChange and OnBlur event for editors (TelerikTextBox, NumericTextBox, and others) is not fired in InCell edit mode with Tab key.

 

2 comments
Ron
Posted on: 22 Jan 2025 08:35

We are experiencing the same problem in the telerikgrid set to InCell-editmode.

When using 'Tab' to navigate between cells the OnChange event does not fire.

Our current work around is to intercept the keydown-event and execute identical to the one linked to the OnChange-event handler in the (Numeric)Textbox in the cell.

 

Example :

<EditorTemplate>

                                                <div @onkeydown="@(async (k) => await KeyDownHandlerAsync(k)">
                                                    <TelerikNumericTextBox T="int?"
                                                                              Decimals="0"
                                                                              Arrows="false"
                                                                              Max="@HelpersDisplayFormats.IntFieldMaxNrOfDecimals(formats.Digits)"
                                                                          
                                                                              ValueChanged="@(async (int? value) => await ValueChangedHandlerAsync(value))"
                                                                              OnChange="@(async (value) => await DoOnChangedHandlerAsync(value))" />
                                                </div>

</EditorTemplate>

// KeyDownHandler :

        private async Task KeyDownHandlerAsync(KeyboardEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine($"Key DOWN: {e.Key}");
            if (e.Code == "Tab")
            {
                // tab intercept! call 'OnChange' event handler here

            }
        }

 

 

Wei
Posted on: 27 Jul 2021 22:45

onkeydown event fires first from js, key code enter or tab will trigger the moving of the edit to next cell (and closing existing edit will call dispose of original edit template), so at onblur event of existing edit control, the control from blazor side should be disposed already. I don't think OnBlur should be handled in key navigation sequence. 

 

but yes to OnChange should fire before closing existing control.

thanks

wei