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

Suspending a virtual grid

Hi there,

I need to force a virtual grid to cease firing its query and save events for a time, and then refresh the entire grid. We have a feature where the structure of a grid can be imported, while that grid is open - and this will affect many other open grids. These other grids need to stay open, but cannot access the data store while it is being changed.

I looked at BeginInit/EndInit, but it doesnt seem to suspend the query events.

Is there a way to do this asside from setting a flag and not carrying out any operations in the query event handlers if the flag is set?

Cheers,
TERRY ROSSOW

5 Replies

AD Administrator Syncfusion Team July 20, 2006 05:44 AM UTC

Hi Terry,

Please try making the changes between the BeginUpdate() and EndUpdate() methods followed by refreshing the grid. The virtual grid will get refreshed by calling the the ResetVolatileData method, this would be called internally when you call Refresh.

this.gridControl1.BeginUpdate();
////code////
this.gridControl1.EndUpdate();
this.gridControl1.Refresh();

Let me know if this helps.
Regards,
Rajagopal


TR Terence Rossow July 20, 2006 07:06 AM UTC

Thanks for the reply.

Your suggestion doesn''t seem to work. I put a write line in the grids, printing out the name of the function being called, and output "Begin Update" when the BeginUpdate function was called:

Begin Update:
OnQueryRowCount
OnQueryColCount
OnQueryColHeader
OnQueryColHeader
OnQueryDataCellInfo
OnQueryDataCellInfo

etc.

Is there anything else I need to do to make this work?

Cheers,
TERRY ROSSOW


AD Administrator Syncfusion Team July 20, 2006 02:08 PM UTC

Hi Terry,

This is by design that, Query events will get fired continously. For a non virtual grid, you can refer to the OneTimeOnlyQueryCellInfo sample in the browser samples shipped with the product.

C:\Syncfusion\Essential Suite\Grid\Samples\Performance\OneTimeOnlyQueryCellInfo

Thanks,
Rajagopal



AD Administrator Syncfusion Team July 20, 2006 07:36 PM UTC

Instead of using flags to avoid the event handler code, you can also unsubscribe to the events when you want to suspend them and then re-subscribe when you want to start them back up.


TR Terence Rossow July 21, 2006 02:06 AM UTC

Thanks for the reply.

I could''t remove the events, as then our grids cannot paint properly anymore. So what I did was implement a cache of GridStyleInfo objects that is updated as the query events are called. Then when a flag is set the grid simply uses the cache, allowing the data to be updated. Works well as long as you don''t scroll outside the area that was queried for the cache...

Loader.
Live Chat Icon For mobile
Up arrow icon