Declined
Last Updated: 15 Sep 2023 10:54 by ADMIN
Martin
Created on: 09 Mar 2023 12:38
Category: VirtualGrid
Type: Bug Report
0
VirtualGridDateTimeEditor: Cannot always change date by just simply typing it.

Repro steps:

  1. Create a RadVirtualGrid
  2. Give it a DateTime column
  3. Make sure the editor (VirtualGridDateTimeEditor) accepts dutch formats for dates (dd-MM-yyyy)
  4. Add a row with value: 30-11-2023

  5. Double click on the value and try to change it my literally typing: "31-12-2023"

Observed behavior:

  • A field with the value 01-12-2023

    (this happens as soon as you type "31")
  • The user needs to first enter the month, then the day to correct this.

Expected behavior:

  • A field with the value: 31-12-2023

Observation / suggestion:

  • The controle tries to validate and correct EVERY input, even when the input is not finished yet. Everybody knows "31-11-2023" is an incorrect value. But during changing it, this should not matter. The scope at that point should be: Making the user happy by accepting the input. When the user leaves the field, or enters the last digit, validation should take place. Or, if halfway entering the value, the totale date is invalid, do not change it and wait for the user to complete.

 

1 comment
ADMIN
Dinko | Tech Support Engineer
Posted on: 15 Mar 2023 14:02

Hi Martin,

Thank you for the provided details and steps.

This behavior comes from the RadDateTimePickerElement inside the editor. The editor is represented by a RadDateTimeEditorElement which derives from RadDateTimePickerElement. You can see the same behavior when using the RadDateTimePicker control stand-alone. In this case, you could set the MaskType property of the TextBoxElement inside the control to FreeFormDateTime. The validation will be triggered when the user leaves the cell. You can set this property in the CellEditorInitialized event handler. Give this property a try and let me know how it goes.

private void RadVirtualGrid1_CellEditorInitialized(object sender, VirtualGridCellEditorInitializedEventArgs e)
{
    var dateTimeEditor = e.ActiveEditor as VirtualGridDateTimeEditor;
    if (dateTimeEditor != null)
    {
        var editorElement = dateTimeEditor.EditorElement as RadDateTimeEditorElement;
        editorElement.TextBoxElement.MaskType = MaskType.FreeFormDateTime;
        editorElement.Format = DateTimePickerFormat.Custom;
        editorElement.CustomFormat = "dd-MM-yyyy";
    }
}

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.