BBjStandardGrid::setColumnSortedByRelatedData
Description
In BBj 6.0 and higher, this BBjStandardGrid method specifies whether a particular column is to be sorted by relatedData rather than by the text of the cells.
Syntax
Return Value |
Method |
void |
setColumnSortedByRelatedData(int columnIndex, boolean p_sortByRelated) |
Parameters
Variable |
Description |
columnIndex |
Specifies the zero-based index on which to sort. |
p_sortByRelated |
Indicates whether data should be sorted by related data. |
Return Value
None.
Remarks
A column is always in one of three states:
- Unsorted
- SortedByText)
- SortedByRelatedData
Calling sortByRelatedData( A, TRUE ) causes column A to assume the state of SortedByRelatedData and to be immediately sorted by related data. If column A is in the state SortedByRelatedData then calling sortByRelatedData( A, FALSE ) causes column A to assume the state of Unsorted.
If column B is in the state Unsorted then calling sortByColumn(B, sortOrder) will cause column B to assume the state SortedByText. But if column B is in the state SortedByRelatedData then calling SortByColumn(B, sortOrder) does not change the state of column B.
Special care should be taken when using this method if sortByMultipleColumns is FALSE since changing the sortByRelatedData value for one column causes that column to be sorted which in turn causes all other columns to assume the state of Unsorted. In particular consider the following sequence of commands:
0990 grid!.setSortByMultipleColumns( 0 )
1000 grid!.sortByRelatedData( A, 1 )
1010 escape
1020 grid!.sortByColumn( A, grid!.SORT_DESCENDING )
1030 escape
1040 grid!.sortByRelatedData( B, 1 )
1050 escape
1060 grid!.sortByColumn( A grid!.SORT_DESCENDING)
1070 escape
Here is a breakdown of how this example performs:
Line |
Sorts the Grid |
1010 |
In ascending order by the relatedData of column A |
1030 |
In descending order by the relatedData of column A |
1050 |
In ascending order by the relatedData of column B and column A will be unsorted |
1070 |
In descending order by the text value of column A |
Note: The grid is sorted by RelatedData at line 1010 but is sorted by text data at line 1070 because column A became unsorted after executing line 1040.
Example
|
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.