BCGSoft.Controls.Grid Namespace : GridData Class |
'Declaration Public Class GridData Inherits System.ComponentModel.Component
'Usage Dim instance As GridData
public class GridData : System.ComponentModel.Component
public __gc class GridData : public System.ComponentModel.Component
public ref class GridData : public System.ComponentModel.Component
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
BCGSoft.Controls.Grid.GridData
Grid implementation allows to separate data and UI. You can create a GridData object separately and the use it in one or more Grid controls by setting GridControl.GridControlData property.
GridData object manages a collection of rows. Rows can be accessed through the RowCollection property.
When you sort or group data the actual RowCollection is not modified (unless you set AccessRealDataOnly property to true). Instead the GridData creates an internal collection of sorted rows and access it as necessary. In group mode it creates a tree (which can be iterated through RootNodes) and flat collection of all rows with group rows (GroupNodes), which can be iterated using GroupIndexCollection.
It's highly recommended to use GetRow method for get operations instead of accessing the above collections. This methods takes into account current mode (virtual, group) and sort.
Because rows are managed by GridData, row height also depends on GridData settings. In particular, you need to set DisableAutoFitRowContent to false in order to enable this feature.
Note. This feature should be enabled for Excel-like grids only for performance reasons.
To enable Virtual Mode you have to set the VirtualMode property to true and specify number of rows in the RowCount property.
To enable (initialize) Group Mode you have to call CreateGroup (if group mode has not been initialized).
To disable Group Mode call ClearGroups.
When the GridData creates groups, it inserts special rows represented by the GroupNode class into index. Group nodes behave as regular rows, except the fact they don't use ItemCollection. They expose data via DataItem property, which is essentially represents the data we group by. For example, if we have a report with {Name, Age, Email} and group by Age, group node's data will contain Age and its DataIndex property will be 1.
To clear current sort call ClearSort.
If you have several grids working with the same data and want to synchronize their layout (in most cases the layout is synchronized automatically) call RaiseGridLayoutChanged.