We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Prevent rendering between refresh and ondatabound call

Hi,

we try to make the detail state persitent. you already answered how to do this in a few questions (ref and ref2 ). we still miss one thing: how to prevent the rendering between refresh and ondatabound call ?

we already tried to  set PreventRender to true in OnActionBegin but this doesnt help. our goal is to prevent any rendering before restoring the detail row state


Thanks


7 Replies

SP Sarveswaran Palani Syncfusion Team January 19, 2023 04:31 AM UTC

Hi Christoph,

Greetings from Syncfusion support.


We would like to inform that by setting args.cancel as true will prevent the inbuilt operation. Here we have used ActionBegin event of DataGrid and by using the request type as Save we have prevented the inbuilt operation. Kindly check the attached code snippet and documentation for your reference.


public async Task DataBoundHandler (ActionEventArgs<Order> args)

    {

        if(args.RequestType == Syncfusion.Blazor.Grids.Action.Save && IsSave)

        {

            args.Cancel = true;

           

        }

    }


Reference: https://blazor.syncfusion.com/documentation/datagrid/events#onactionbegin


Please let us know if you have any concerns.


Regards,

Sarvesh



CH Christoph January 19, 2023 01:03 PM UTC

Hi,


thanks for your suggestion - could you provide a full example ? we dont get it to work with the provided informations.

OnActionBegin is never called with "Syncfusion.Blazor.Grids.Action.Save", only with refresh.


we are not talking about editing the data itself, the data source changed from outside and so a data bound and refresh is triggered


we provided an example with out persistent details module. if you click a few times on ChangeData button, you should see the flickering ( this get worse with more data )


Attachment: griddetailspersistent_aa25b82e.zip


SP Sarveswaran Palani Syncfusion Team February 4, 2023 07:48 AM UTC

Dear Christoph,


We apologize for the delay and any inconvenience you may have experienced. After reviewing your sample, we have determined that when you use the "changedata" button, it updates the data in the grid component at runtime, causing the component to rerender. This may result in flickering when you click the "changedata" button. To address this issue, we suggest avoiding the use of the task delay method, as it may also contribute to the problem. If you have any further questions or concerns, please do not hesitate to reach out to us. We are here to assist you.


Best regards,

Sarvesh



CH Christoph February 4, 2023 11:21 AM UTC

The delay function is just to simulate a time consuming function call like requesting the database…

so you say that this flickering can’t be prevented ?

do you have any other approach that to restore the detail expand state after data has updates without flickering ?



SP Sarveswaran Palani Syncfusion Team February 7, 2023 03:58 AM UTC

Hi Christoph,

We would like to inform you that, we were unable to prevent the flickering, in that meantime we’ll render the spinner when some data operation running in the background. This is the default behavior.

Please get back to us, if you have any concern.

Regards,
Sarvesh



CH Christoph February 7, 2023 01:51 PM UTC

Well then its a bug isnt it ?

setting PreventRender to true inside OnDataBound should prevent all rendering but its still render as if the parameter has no effect



SP Sarveswaran Palani Syncfusion Team February 22, 2023 03:54 AM UTC

Hi Christoph,

Sorry for the delay and inconvenience cause.

We would like to inform you that the PreventRender property is used to internally overrides the ShouldRender method of the grid to prevent re-rendering. OnDataBound event occurs before data is bound to DataGrid, but the ShouldRender method isn’t executed at the first-time component rendered. This is how the PreventRender method behaves.

If you have any further queries, please get back to us

Regards,
Sarvesh


Loader.
Up arrow icon