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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

True virtual grid

Thread ID:

Created:

Updated:

Platform:

Replies:

55989 Feb 7,2007 09:59 PM UTC Feb 9,2007 01:06 AM UTC WinForms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 7, 2007 09:59 PM UTC


I've been reading up on using the QueryCellInfo, QueryRowCount, QueryColCount, etc. for implementing a virtual grid. But if I have, say, 100,000 rows of data to display, the grid still internally creates 100,000 rows in the grid, along with that many internal data structures like collections for hidden rows, row heights, etc. Is this correct?

What I'd like to do essentially is build a truly virtual grid in that the only true rows in the grid are the ones that can be visibly displayed in the grid, and that my model provides the data for these rows given a top row index. Meaning, that I would have 100,000 rows to display, but the user can only visually see maybe 20 rows at a time in the grid (given the size). So I'd like that truly only 20 rows exist in the grid.

Does Essential Grid provide a mechanism for supporting this? The scrollbars would be something to consider, since even though the grid would have only 20 rows in it, there is actually 100,000 rows of virtual data that *could* be displayed. In which case the scrollbars would have to account for this. Before I investigate how to do this, I was just wondering if the grid already provided a way to. Also, in my case I don't have to worry about keeping track of hidden rows or row heights, since all rows would be visible with the same height. Thanks.

- Steve

Administrator [Syncfusion]
Replied On February 7, 2007 11:49 PM UTC

Hi Steve,

if I have, say, 100,000 rows of data to display, the grid still internally creates 100,000 rows in the grid, along with that many internal data structures like collections for hidden rows, row heights, etc. Is this correct?

>>>>>>>>>>>>>>>>>>>>>>
No, The virtual grid does not hold any data. All data is supplied to the grid from an external data source on demand. When the grid needs a particular cell, say to draw it, it asks the external data source for that value. Since no data is actually loaded into the grid, there is virtually no limit imposed by Essential Grid on the number of rows and columns you can have.

The Rows.Hidden is actually a dictionary. When you hide a row explictly using Model.Rows.Hidden property, an entry is created in the dictionary, and when you make a row visible, this entry is removed from the dictionary. When you call Hidden.SetRange, the grid will only allocate storage for the entries that you specify. This means that if you have 5,000,000, and hide every other one with this technique, then there will be 2.5M entries. However, in such a situation, you could implement such a grid virtually using QueryRowHeight with no memory allocationn. I guess my commnet was to suggest if you use a virtual grid, special knowledge of what you are trying to hide may allow you to do something more economical than the standard implementation that has to work for any case.

Another consideration for the short term is that grids with a large number of hidden rows can have poor scrolling performannce. If you manage your own dictionary, you can actually avoid this scrolling performance penalty by treating all rows as if they were contiguous no matter where they are in your external data source. This would mean that you would have row map allocated, but it would enhanced scrolling performance for the time being.

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 8, 2007 06:28 PM UTC

In the Virtual Grid Mode that you are discussing, are you talking about the case when we implement the QueryCellInfo?

According to the docs, the data retrieved from QueryCellInfo is cached by the grid. From a quick look, it seems that the grid only caches the data for the visible, on-screen, rows/columns. When the grid is scrolled to show a different set of rows/columns it appears that QueryCellInfo then, and only then, asks for the data ( and caches it ). In summary, it appears that QueryCellInfo only gets called for visible, on-screen, cells and that the cached data is only for painting what is seen. Correct?

I know that we'd call ResetVolatileData to get the screen to update, forcing new calls to QueryCellInfo. Is there a way to target just 1 row, i.e. to reset a subset? I'm thinking about avoiding a full repaint/redraw. ( Maybe the grid does a diff and keeps the painting to a minimum?? )

Also: When doing a virtual grid with QueryCellInfo and ResetVolatileData, I ran into the case where I wanted to change the DefaultRowHeight. I happened to have 300,000+ rows in my grid, and I noticed ( by using the debugger to step into the grid code ) that there was a collection of RowHeights that was being iterated. It seemed to be a bit heavy. So, I was also wondering if there is a recommended way to take over the management of RowHeights and make the grid assume that all rows are exactly the same height, so as to avoid iterating over rows.

Sorry about clumping all these questions together.

THANKS!
-scott

>Hi Steve,

if I have, say, 100,000 rows of data to display, the grid still internally creates 100,000 rows in the grid, along with that many internal data structures like collections for hidden rows, row heights, etc. Is this correct?

>>>>>>>>>>>>>>>>>>>>>>
No, The virtual grid does not hold any data. All data is supplied to the grid from an external data source on demand. When the grid needs a particular cell, say to draw it, it asks the external data source for that value. Since no data is actually loaded into the grid, there is virtually no limit imposed by Essential Grid on the number of rows and columns you can have.

The Rows.Hidden is actually a dictionary. When you hide a row explictly using Model.Rows.Hidden property, an entry is created in the dictionary, and when you make a row visible, this entry is removed from the dictionary. When you call Hidden.SetRange, the grid will only allocate storage for the entries that you specify. This means that if you have 5,000,000, and hide every other one with this technique, then there will be 2.5M entries. However, in such a situation, you could implement such a grid virtually using QueryRowHeight with no memory allocationn. I guess my commnet was to suggest if you use a virtual grid, special knowledge of what you are trying to hide may allow you to do something more economical than the standard implementation that has to work for any case.

Another consideration for the short term is that grids with a large number of hidden rows can have poor scrolling performannce. If you manage your own dictionary, you can actually avoid this scrolling performance penalty by treating all rows as if they were contiguous no matter where they are in your external data source. This would mean that you would have row map allocated, but it would enhanced scrolling performance for the time being.

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 9, 2007 01:06 AM UTC

Hi Scott,

In the Virtual Grid Mode that you are discussing, are you talking about the case when we implement the QueryCellInfo?
>>>>>>
No, we are discussed about the implementation of PrepareViewStyleInfo event in a virtual grid. The PrepareviewStyleInfo event does not store any styleInfo properties in a grid. It just set the visual apperence of the grid. All data is supplied to the grid from an external data source on demand. When the grid needs a particular cell, say to draw it, it asks the external data source for that value. But If you use the the QueryCellInfo event of the grid then the grid stores the style properties in a internal catche.

The ResetVolatileData method resets the volatile cache. If you want to refresh the grid and forces the grid cells that are visible at the moment to reload all their data from the datasource then you can call the ResetVolatileData emthod. If you want to repaint the specified range of cell, you need to call the InValidateRange or RefreshRange method. below is a code snippet.

this.gridControl1.RefreshRange(GridRangeInfo.Cells(1, 1, 4, 4));
///or
this.gridControl1.InvalidateRange(GridRangeInfo.Cells(1, 1, 4, 4));

Best regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;