Grid / Rows / Cells
In This Topic
    Cells
    In This Topic
     About Cells

    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

    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:

    • Content - the content widget of a data cell is used to represent the cell value. The column format associated with data cell column is responsible for creating this widget.
    • Editor - the editor widget is used to edit the cell value. The column editor associated with the data cell column is responsible for creating this widget. 

    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

    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:

    • Summary Row - summary rows are created by grouping rules and are used to display information about the group. Each summary row can have an arbitrary number of NSummaryCell instances that are dynamically created.
    • Details Row - this is a non-expandable row which is created by the Master - Details scenarios. The content of each details row can be any number of NDetailsCell instances.
    • Group Row - this is a row that is used as header of a grouping of other group or data rows. The content of each group row can be any number of NGroupRowCell instances.

    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:

    • Mode - defines the mode in which the X position is determined. For the NSpanCellBeginXPosition class the mode is an instance of the ENSpanCellBeginXPositionMode enumeration, while for the NSpanCellEndXPostion it is an instance of the ENSpanCellEndXPositionMode enumeration.

      Following is a description of the entries in the ENSpanCellBeginXPositionMode enumeration:
      RowBeginX - The begin X position is equal to the row begin X position.
      Percent - The begin X position is expressed as a percentage of the row width.
      ColumnBegin - The begin X position is equal to a column begin for the row.
      ColumnEnd - The begin X position is equal to a column end for the row.
      PrevCellEndX - The begin X position is equal to the previous cell EndX.
      AnchorToEndX - The begin X position is equal to the EndX position minus the desired width of the cell.

      The ENSpanCellEndXPositionMode contains similar entries that are described below:
      RowEndX - The end X position is equal to the row end X position.
      Percent - The end X position is expressed as a percentage of the row width.
      ColumnBegin - The end X position is equal to a column begin for the row.
      ColumnEnd - The end X position is equal to a column end for the row.
      NextCellBeginX - The end X position is equal to the next cell begin X position.
      AnchorToBeginX - The end X position is equal to the BeginX position plus the desired width of the cell.
    • Percent - defines a relative position along the row X range. Used only when mode is set to Percent.
    • ColumnRef - a reference to the column whose begin or end is taken into account. Used only when mode is set to ColumnBegin or ColumnEnd.
    • Offset - specifies a fixed offset that is applied to the originally calculated position.

    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 };
    };