October 11, 2012 07:20 by Jervis
Types of Grids
One of the most common misconceptions is the notion that a grid is a grid. In reality, there are several different types of grids and choosing the right one for your needs can help save substantial time and effort. Choosing the wrong grid can result in tremendous effort to make it work the way you need, which is quite frustrating. We will look at the different types of grids and the ways in which they are typically used.
- No assumptions on layout - Cell-oriented grids do not make any assumptions on the layout of data. They work very well when you wish to have complete control over the layout. They allow you to display data that flows over multiple cells and embed controls such as charts that occupy several underlying cells. You can mix different kinds of cells in the same column.
- Excel-like behavior - Each cell is independent of other cells. Commonly, you're able to set 50 different attributes on each cell.
- Formula support - Cell-oriented grids typically offer support for cell-level formulas, similar to Excel.
- No assumptions on data source - Cell-oriented grids do not expect data to be in a certain format. They allow data to be provided on demand from any source. Binding to data usually involves the implementation of simple callbacks.
Data-bound Grid Controls
- Homogenous columns - Data-bound grid controls assume that data in a column will be the same type. They work best when most of your data comes from a straight tabular data source and can be displayed in the same layout. They do not work well if you wish to have more control over the layout of your display.
- Binding to standard types - Data-bound grid controls can be bound to any standard data source with a few lines of code.
- Rich metadata - Data-bound grids utilize type metadata and other information available from data-binding interfaces. Operations such as sorting, filtering, and grouping are also easier to implement with data-bound grids because of this rich metadata.
- Support for editing - Support for editing is implemented in most data-bound grid controls. If the backing data store supports editing, adding new rows, and deleting current rows, such support will automatically become available in data-bound grids.
- Support for automatic updates - Data-bound grid controls can automatically display changes to the data source to which they are bound, provided the data source implements appropriate interfaces.
- Business objects - Data-bound grid controls support displaying data in business objects, provided such data will support one of the commonly used .NET data-binding interfaces.
- Delegating common operations to the server - It is typically desirable to delegate such operations to the server. This is the default behavior with most controls.
- Support for expressions or formulas - Data-bound grid controls do not typically support cell-level formula calculations (like Excel). They instead offer unbound columns where simple expressions may be used to calculate the displayed value. If you need Excel-like formulas, then a cell-oriented grid is a better choice.
- Displaying related data - Data-bound grids that support displaying related information display such data inline. This is referred to as a hierarchical display or nested table. It is possible for a hierarchical grid to support editing and differing levels in nested tables.
- Displaying foreign key references - When you have a foreign key relationship, data-bound grid controls should easily display values from the related table.
- Displaying grouped data - Grouping classifies a list of data based on one or more fields. Data-bound grids can support grouping, along with custom summaries and data updates with multiple field groupings.
Pivot grids are very powerful and allow for the display and analysis of massive amounts of data in a summarized, condensed format. Please be sure to test with at least five times the data you expect to work with (both rows and columns). Also, test with several grouping levels on both the row and column axes.
Tree grids resemble tree controls, but instead of displaying just one column of information, as with a typical tree, they display additional attributes as additional columns. Test for editing and load-on-demand support.