Supporting the Suppression of Redundant Items in a Table

Normally in a table, an item by which a group of data is sorted is displayed for every record in that group. This causes a redundancy of data. This redundancy can clutter a table and make it difficult for a user to read. It may be easier for the user to read the table if only the first item in a group is displayed and the rest are hidden.

In the following table, the first five rows all have "East" as the value for "Region," which is the first column. The next five rows all have "West" for "Region." The next two columns, "Department" and "Profit" have values that change in each row. So the "East" and "West" in the first column are redundantly displayed.

Table with redundant values; described in text

The following example shows the same table, with redundant items hidden.

Same table as before, but no redundant East & West values

Making the table aware of sorted groups

To allow a table not to display redundant items in a column, the data source must provide information about whether the groups are sorted. To do this, the data source must have group-sort type information available for each cell in a DataAccess. For each cell in the Databody, the DataAccess must contain a label that identifies its relationship to a group. These labels tell the table whether to hide or display them. The following table describes the constants for the four labels.

Constant

Description

DataDirector.GROUPSORT_NONE

Not an item by which a group is sorted; the table displays the contents of the cell as usual

DataDirector.GROUPSORT_START

The first item in a group; the table will display this item

DataDirector.GROUPSORT_MIDDLE

A redundant item in a group; the table will hide this item

DataDirector.GROUPSORT_END

The last item in a group; the table will hide this item and knows that there are no more items for this group

Note: If a group crosses more than one physical page, then the item by which the group is sorted is displayed at the very first line of the group, and at the first line of the same group on the next physical page.

The following example shows what the group sort information for the previous table would look like if the labels for identifying group items were visible. The first cell that displays "East" in the table has GROUPSORT_START. Other "East" cells have GROUPSORT_MIDDLE. The last cell that displays "East" has GROUPSORT_END. The same is true for the "West" cells. All other cells have GROUPSORT_NONE.

Table with labels for identifying group items visible

The DataAccess must return one of these values when the table calls getValue, passing DataMap.DATA_GROUPSORT as the type of data being requested.