In This Topic
Data Processing Overview
Data processing refers to the grid built-in abilities to filter, group or self-reference and sort the data. Following is a brief overview:
- Filtering - filtering is the process of passing only certain records from the data source to be displayed by the grid. Each record from the data source that passes the grid filters is represented by row in the grid. The filtering is defined by a collection of NFilterRule instances, accessible from the NGrid.FilterRules property. Filter rules are combined with a logical AND, meaning that in order for a record from the data source to be displayed in the grid it needs to pass all filter rules. See Filtering for more information.
- Grouping - grouping is only applicable for NTableGrid instances. Grouping helps you hierarchically organize the rows of a grid according to some common for each group value. The NTableGrid supports multi-level grouping. Grouping is defined by a collection NGroupingRule instances, accessible from the NTableGrid.GroupingRules property. Because each grouping rule can produce multiple groups and because there are multiple grouping rules, this creates a hierarchically grouped grid. Because groups are produced for records that share a common grouping value, there is a sorting direction associated with each grouping rule. See Grouping for more information.
- Self-Referencing - self-referencing is only applicable for NTreeGrid instances. Self-referencing produces a tree-like structure from a tabular data source. This is achieved by specifying two fields of the data source - one that identifies each record uniquely and another that specifies the parent record of the record. Because this generates a hierarchical structure, grouping and self-referencing cannot coexist. This is the major feature that separates the NTablerGrid from the NTreeGrid. See Self Referencing for more information.
- Sorting - sorting is the process of sorting the rows that reside on the same hierarchical level. The grid support multiple sorting rules that define a certain sorting order of the rows that reside at the same level in the grid grouping or self-referencing level. See Sorting for more information.
Both the NTableGrid and NTreeGrid are performing the Filtering and Sorting processes, however the order of the data processing algorithm is different for each type of grid. Following is an overview of the data processing algorithm for each type of grid.
Table Grid Data Processing
Following is the data processing algorithm that the table grid uses to display a tabular data source.
- Filtering - the table grid creates an instance of the NRecordDataRow row for each record from the data source that passes all the filtering rules. See Filtering for more information.
- Grouping - the table grid performs hierarchical grouping. The first grouping rule defines the primary split of the rows in the first level groups. If there are additional grouping rules the groups generated by the previous grouping rule are recursively split to child groups that satisfy the respective grouping rule. An instance of the NGroupRow row is created for each group. Each NGroupRow row can contain other NGroupRow rows and the leaf NGroupRow row contains the NRecordDataRow rows for which all grouping rules produced the same value. The NGroupRow rows at each level are sorted according to the grouping rule sorting direction. See Grouping for more information.
- Sorting - finally the table grid sorts the rows contained in each leaf NGroupRow, if there are any grouping rules, or simply the rows in the grid, if there are no grouping rules defined. See Sorting for more information.
All phases of the data processing algorithm are optional and are performed if the grid has the respective rules defined. In the absence of any rules the table grid simply creates a NRecordDataRow row for each record of the data source. The rows are ordered in the same way as the respective records from the data source.
Tree Grid Data Processing
Following is the data processing algorithm that the tree grid uses to display a tabular data source.
- Filtering - the tree grid creates an instance of the NTreeDataRow row for each record from the data source that passes all the filtering rules. See Filtering for more information.
- Self-Referencing - the tree grid generates a hierarchically organized structure of NTreeDataRow rows, by placing each NTreeDataRow row inside the child rows of a certain parent NTreeDataRow. This hierarchic organization is defined by two fields from the data source - the NTreeGrid.IdFieldName property specifies the field from the data source that identifies each record uniquely, while the NTreeGrid.ParentIdFieldName property specifies the field from the data source that identifies the parent record for each specific record. The Self-Referencing process produces a general tree of NTreeDataRow instances.
- Sorting - finally the tree grid sorts the records each hierarchy level according to the sorting rules. See Sorting for more information.
All phases of the data processing algorithm are optional, although it does not make sense to use tree grid if there is no Self-Referencing defined.