SGrid 2.0

The following categories are described:

  1. Columns
  2. Rows
  3. Cells
    1. Individual Properties and Methods
    2. The cGridCell object
  4. State: Edit Cell, Hot Cell and Selections
  5. Sorting
  6. Grid Settings and Options
    1. Image Lists
    2. Hierarchical Grouping
    3. Appearance
    4. Behaviour
    5. General
  7. Events
  8. Persistence

1. Columns

SGrid is designed to operate with a fixed number of columns. For performance it is always better to add columns prior to adding any rows, making columns invisible if you want to. There are two types of columns:

  1. Standard Columns

    Standard columns appear in the header of the control and render from left to right. These columns may be made invisible, re-ordered and grouped hierarchically.

  2. Optional Row-Text Column

    The row-text column is used to display text and/or icons which stretch across multiple columns in the grid. The Row-Text column renders below the standard columns. If you are using one, the row-text column must always be the last column in the grid. Whether the Row-Text column's text appears will depend upon the height of the row that it appears in.

    Note when you use the hierarchical grouping option SGrid internally uses a row-text column to render the group. The Grid will automatically add this if it doesn't exist, but for performance you may want to add one up-front.

Manipulating columns is achieved through the following properties and methods:

2. Rows

Rows can be added, inserted to the grid, or removed or made invisible. If you can add rows in order, you can choose to have SGrid pre-allocate a number of rows for you, rather than adding each one individually, which can improve performance. To do this, set the Rows property to the number of rows that you want.

There are two types of rows: standard rows and group rows. Group rows appear when you create a hierarchical grouping in the grid, and have the RowIsGroup property set to True. Note you cannot insert grouping rows directly without setting up a grouping using one of the hierarchical grouping methods. Note also that although you can change the properties of grouping rows using things like the RowVisible property, this will in general prevent correct operation of expand and collapse of groups. You should also only add rows to the end of the grid and use the ShiftLastRowToSortLocation method to ensure the correct position of the new row.

3. Cells

Cells may either be changed using individual properties or by using a cGridCell object.

3.1 Individual Properties

3.2 The cGridCell object

The grid cell object is a disconnected object that represents a single cell. You can either obtain a new cell object to assign to the grid using the NewGridCellFormatObject or obtain one pre-populated with existing cell details using the Cell property. To assign any changes back to the grid, use the Cell property to set it back again. The object itself contains all of the information in the individual cell properties.

4. State: Edit Cell, Hot Cell and Selections

SGrid 2.0 can be editable, track cells with the mouse and select either individual cells or entire rows. These properties and methods allow you to configure these modes and determine information about the current state.

5. Sorting

Sorting is configured using SGrid's SortObject. This object maintains details of both the currently hierarchical grouping state and non-grouped sort for any row. You can have any number of columns in the sort, and each one can be configured for the type of data and order you want to sort in. These methods are exposed by the grid for sorting:

The cGridSortObject allows you to configure the sort you wish to apply. For each sort column, you specify the SortColumn, SortOrder and SortType properties. To add a new column to the sort, set the index of the sort item to one greater than the current sort count.

6. Grid Settings and Options

6.1. Image Lists

Up to two image lists can be associated with the control; one for the main grid and one for the header. If you do not define a separate ImageList for the header then the control will assume that the main ImageList should be used.

6.2. Hierarchical Grouping

6.3. Appearance

6.4. Behaviour

6.5. General

7. Events

8. Persistence

Grid data can be persisted and reloaded very quickly using the SaveGridData and LoadGridData methods. These methods only persist the cell data and row information, so the data must be subsequently re-loaded into a grid with the exact same column structure.