Issue with Real-Time UI Updates in Grid Edit Settings Dialog Template

I am facing an issue with real-time UI updates during grid editing in the Edit Settings dialog. When I click "Add" or "Edit," the dialog box opens, and there is a flag that determines whether a textbox is displayed. If the flag is set to true, the textbox should appear. However, in my case, the textbox only appears after clicking the "Save" button, rather than updating in real time. The StateHasChanged method does not seem to resolve this issue.


3 Replies 1 reply marked as answer

NP Naveen Palanivel Syncfusion Team January 23, 2025 09:31 AM UTC

Hi sami khan,

Greetings from Syncfusion,

Based on your issue, we would like to let you know that we have optimized the Grid component's rendering during external actions to enhance performance. Therefore, we recommend using the grid's public method PreventRender(false) in the onchange event to update the UI real time and achieve your desired result. Please refer to the attached code snippet for further reference.

                          <div class="form-group col-md-6">

                            <SfCheckBox @bind-Checked="isChecked" Label="Change" @onchange="onChange"></SfCheckBox>

                        </div>

                        @if (flag == true)

                        {

                            <div class="form-group col-md-6">

                                <SfTextBox ID="CustomerID" @bind-Value="@(Order.CustomerID)" TValue="string" FloatLabelType="FloatLabelType.Always" Placeholder="Customer Name">

                                </SfTextBox>

                            </div>

                        }

 

                    </div>

……

    private async Task onChange(Microsoft.AspNetCore.Components.ChangeEventArgs args)

    {

        string check = args.Value.ToString();

        if (check == "True")

        {

            flag = true;

        }

        else

        {

            flag = false;

        }

        Grid.PreventRender(false);

    }

 



Sample:
https://blazorplayground.syncfusion.com/embed/BtLoXCBUAhdzqddy?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

Regards,
Naveen


Marked as answer

SK sami khan replied to Naveen Palanivel January 23, 2025 03:50 PM UTC

Thank you, Naveen Palanivel, for your response. I have managed to control this with another logic, but I have also tested your provided solution, and it works as well. Thank you so much for your help and response.



PS Prathap Senthil Syncfusion Team January 24, 2025 01:51 PM UTC

Thanks for the update. We are happy to hear that the provided information was helpful.

Please get back to us if you face any issues with the provided solution.


Loader.
Up arrow icon