Declaration: ChartBook.Tables[].FilterAndSort (FilterExp: string; FilterColumns: array of integer; IgnoreCase: boolean; FilterMode: TFilterMode; SortColumn: integer; Ascending: boolean);
The method FilterAndSort allows to set the enabled/disabled state of all rows according to some filter criterion. In addition, the enabled and the disabled rows may be sorted separately. The following image shows part of a screen shot of a publications database which has been filtered for the keyword "Linux" and sorted by column "Title". The found database entries show up in the first four rows of the table, all the other entries are grayed out and listed below the active entries.

The filtering process is controlled by the parameters FilterExp, FilterColumns, IgnoreCase, and FilterMode. The optional sorting is controlled by the parameters SortColumn and Ascending. Any row which matches the filter criteria is enabled (= shown with regular colors), all other rows are disabled (= grayed out).

The parameter FilterExp contains the search expression and may be either a plain substring, a regular expression, or a boolean search expression depending on the parameter FilterMode. The parameter IgnoreCase controls whether lower and upper case characters are treated the same. The search for the filter keyword(s) is restricted to those columns specified by the open array parameter FilterColumns.

The parameter SortColumn determines which column is used as the sorting criterion, both for the enabled and the disabled row entries (please note that the enabled and disabled rows are sorted separately). Setting SortColumn to negative values suppresses any sorting - the rows are displayed at their original position, resulting in a mix of enabled and disabled rows. When SortColumn is set to zero, the rows are not sorted, but their positions are rearranged so that all enabled rows are listed first, and all disabled rows are following. A positive value of SortColumn displays the filtered list sorted along the corresponding column. The parameter Ascending controls the direction of the sorting.

Hint: Please note that after changing the text of any cell of a filtered row, the method FilterAndSort has to be called again in order to reflect the updated selection.