PrepareCellStyle not triggered correctly for frozen columns (GridCellFactory)

Posted by: daniel.koffler on 14 April 2023, 10:23 pm EST

    • Post Options:
    • Link

    Posted 14 April 2023, 10:23 pm EST

    Hello,

    please refer to the example app attached.

    • Navigate to “Fetch data” page
    • Select cell 0,0 (first column and row)
    • Press delete button

    If Frozen columns is set to “1” the method PrepareCellStyle is called for column “0” only. If you remove the frozen column, the method is called for all columns. (also check debug log for details.)

    I want to format all cells in a row based on validation result.

    Because just the frozen column is triggered the other columns are not formatted correctly.

    Thank you

    Daniel

    ComponentOneBlazorIssue.zip

  • Posted 16 April 2023, 3:46 pm EST - Updated 16 April 2023, 3:51 pm EST

    Hi Daniel,

    Thank you for your sample, we tried to replicate the issue at our end. But we are unable to replicate the issue at our end.

    Please refer to the attached sample for reference. Please also refer to the attached screenshot.

    Regards,

    Manish Gupta

    TOne_Style.zip

  • Posted 16 April 2023, 5:22 pm EST

    Hello,

    please find enclosed a more detailed example. “IsValid” is updated if property is changed.

    • Navigate to “Fetch data” page
    • Select cell 0,0 (first column and row)
    • Press “delete” button

    PrepareCellStyle is called for (2) frozen columns only.

    Thank you

    Daniel

  • Posted 16 April 2023, 5:23 pm EST

    Attachment for previous post.

    Archive.zip

  • Posted 18 April 2023, 4:50 pm EST

    Hi,

    Thank you for sharing the sample. In the investigation, it is observed that the issue occurs only when the cell data is deleted using the Delete key. This does not refresh the all cells and the issue occurs.

    This can be fixed by adding the following code in the CellFactory.

     protected override bool OnKeyDown(KeyboardEventArgs e)
            {
                if(e.Key== "Delete")
                {   
                   Grid.Refresh();
                }
                return base.OnKeyDown(e);
            }

    Regards,

    Manish Gupta

  • Posted 18 April 2023, 5:25 pm EST

    Thanks that works. Although in my opinion the grid should do that OOTB, similar to when a cell is edit in any other way.

  • Posted 19 April 2023, 3:47 am EST

    Hi Daniel,

    It works for edit and this occurs only for the delete key.

    Regards,

    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels