Cells are contained in Rows. Cells are represented by the NCell abstract class. The following image shows the current NCell class hierarchy:
Generally there are two types of cells - NDataCell and NSpanCell, which are described below.
Cells are contained in Rows. Cells are represented by the NCell abstract class. The following image shows the current NCell class hierarchy:
Generally there are two types of cells - NDataCell and NSpanCell, which are described below.
Data cells are contained in NDataRow instances. Each data cell is used to represent a cell from the data source (e.g. a field value for a specific row). Each data cells can have two child widgets:
Data cells are dynamically created and destroyed when the data row enters and exits the grid viewport. This process is known as virtualization and helps the grid manage huge amounts of data, since only the visible rows will have data cells created.
Span cells are cells that are used to display additional information in the grid. Currently span cells are used as content of the following types of rows:
Span cells are usually created by the developer, since as mentioned they usually display additional information in the grid.
Since span cells are not associated with a specific column, it is up to the user to specify their X position. Span cells are usually configured to span more than one column (for example group rows by default have a single NGroupRowCell that spans the entire row), and that is why they are called span cells.
The NSpanCell.BeginXPostion property exposes an instance of the NSpanCellBeginXPosition attribute that controls the begin X position of the span cell. Respectively the NSpanCell.EndXPosiotion property exposes an instance of the NSpanCellEndXPostion attribute that controls the end X position of the cell.
Both the NSpanCellBeginXPosition and NSpanCellEndXPostion classes derive from the base NSpanCellXPosition<TPostionMode> class that exposes properties that define an X position. Following is a brief overview:
The following code snipped creates two NGroupRowCell instances that contain additional information about a grouping:
Span Cell Positioning |
Copy Code
|
---|---|
// create custom group row cells that display the person Name and number of orders groupingRule.CreateGroupRowCellsDelegate = delegate(NGroupingRuleCreateGroupRowCellsArgs arg) { string personName; //TODO: get person name int ordersCount; //TODO: calculate orders count // create the group row cells NGroupRowCell personNameCell = new NGroupRowCell(personName); personNameCell.EndXPosition.Mode = ENSpanCellEndXPositionMode.NextCellBeginX; NGroupRowCell ordersCountCell = new NGroupRowCell("Orders Count:" + ordersCount); ordersCountCell.EndXPosition.Mode = ENSpanCellEndXPositionMode.RowEndX; ordersCountCell.BeginXPosition.Mode = ENSpanCellBeginXPositionMode.AnchorToEndX; return new NGroupRowCell[] { personNameCell, ordersCountCell }; }; |