DataTableView

Overview

The DataTableView represents customized view of a DataTable for sorting, filtering, grouping and navigation.

It is usuallly used to output table data in UI. By default if is created with the DataViewRowState flag set to Current which means that only currently visible rows from the table will be included in the view. But you can create the view to represent few other states, check DataViewRowState enum description for more info.

The DataTableView can also be subscribed to track changes of the DataTable. To do it, you need to register on DataTable's TableChangedEvent. But please consider a performance impact of this, because every modification of the table's data or structure will lead to view's state invalidating hence forces its entire refresh. The alternative is to ommit subscribtion to table's notifications and to force view's update manually by calling its refresh method. You can aslo manage refresh process with AutoRefresh property - if set to false refresh won't be called on every tableChanged notification.

Location


 

constructor (DataTable)

Creates an instance of a DataTableView class tied to a given DataTable object and DataViewRowState flag set to Current.

 

constructor(aTable: DataTable)

 

DataTableView(DataTable aTable)

Parameters:

  • aTable: A table to view. IllegalArgumentException is raised if table hasn't been given.

constructor (DataTable, DataViewRowState)

Creates an instance of a DataTableView class tied to a given DataTable object using the given DataViewRowState flag.

 

constructor(aTable: DataTable; aViewRowState: DataViewRowState)

 

DataTableView(DataTable aTable, DataViewRowState aViewRowState)

Parameters:

  • aTable: A table to view. IllegalArgumentException is raised if table hasn't been given.
  • aViewRowState: A mode state of rows the newly created view will hold.

AutoRefresh

 

property AutoRefresh: Boolean read write;

 

Boolean AutoRefresh { __get; __set; }

Count

 

property Count: Integer read;

 

Integer Count { __get; }

filterAndSort (Filter, String, Boolean): List<DataRow>

 

method filterAndSort(aFilter: Filter; aColumnName: String; anAsc: Boolean): List<DataRow>

 

List<DataRow> filterAndSort(Filter aFilter, String aColumnName, Boolean anAsc)

Parameters:

  • aFilter:
  • aColumnName:
  • anAsc:

filterAndSort (Filter, String[], Boolean[]): List<DataRow>

 

method filterAndSort(aFilter: Filter; aColumnNames: array of String; anAscArray: array of Boolean): List<DataRow>

 

List<DataRow> filterAndSort(Filter aFilter, String[] aColumnNames, Boolean[] anAscArray)

Parameters:

  • aFilter:
  • aColumnNames:
  • anAscArray:

filterAndSort (Filter, Comparator<DataRow>): List<DataRow>

 

method filterAndSort(aFilter: Filter; aComparator: Comparator<DataRow>): List<DataRow>

 

List<DataRow> filterAndSort(Filter aFilter, Comparator<DataRow> aComparator)

Parameters:

  • aFilter:
  • aComparator:

filterDataRows

 

method filterDataRows(aFilter: Filter): List<DataRow>

 

List<DataRow> filterDataRows(Filter aFilter)

Parameters:

  • aFilter:

getFilter

Returns the Filter used every time on a DataTableView's content refresh.

 

method getFilter: Filter

 

Filter getFilter()

group<T>

 

method group<T>(aKeyEvaluator: KeyEvaluator<T>): Map<T, List<DataRow>>

 

Map<T, List<DataRow>> group<T>(KeyEvaluator<T> aKeyEvaluator)

Parameters:

  • aKeyEvaluator:

refresh

Forses to rebuild index of the current view. Call this method when you haven't subscribed on table's events and you know, that table has been changed.

 

method refresh

 

void refresh()

Row

 

property Row[aIndex: Integer]: DataRow read;

 

DataRow Row[Integer aIndex] { __get; }

setFilter

Sets a Filter to be used every time on a DataTableView's content refresh.

Note: Set it, if you want your data always be filtered according to some rule.

 

method setFilter(aValue: Filter)

 

void setFilter(Filter aValue)

Parameters:

  • aValue: The new Filter object to be set.

setSorting (String, Boolean)

This method is a helper method over Sorting property setter. It allows you to avoid creating Comparator if you want to sort the view by one column.

 

method setSorting(aColumnName: String; anAsc: Boolean)

 

void setSorting(String aColumnName, Boolean anAsc)

Parameters:

  • aColumnName: A column name to use during sorting.
  • anAsc: Direction of sorting: TRUE - for ascending sorting; FALSE- for descending.

setSorting (String[], Boolean[])

This method is a helper method over Sorting property setter. It allows you to avoid creating Comparator if you want to sort the view by several columns with no extra data manipulation.

 

method setSorting(aColumnNames: array of String; anAscArray: array of Boolean)

 

void setSorting(String[] aColumnNames, Boolean[] anAscArray)

Parameters:

  • aColumnNames: A set of column names to use during sorting.
  • anAscArray: A set of sorting directions: TRUE - for ascending sorting; FALSE- for descending.

sort (String, Boolean): List<DataRow>

This method is a helper over sort(Comparator). It allows you to avoid manually creating Comparator if you want to sort the view by single column with no extra data manipulation.

 

method sort(aColumnName: String; anAsc: Boolean): List<DataRow>

 

List<DataRow> sort(String aColumnName, Boolean anAsc)

Parameters:

  • aColumnName: A column name to use during sorting.
  • anAsc: Direction of sorting: TRUE - for ascending sorting; FALSE- for descending.

sort (String[], Boolean[]): List<DataRow>

This method is a helper over sort(Comparator). It allows you to avoid manually creating Comparator if you want to sort the view by several columns with no extra data manipulation.

 

method sort(aColumnNames: array of String; anAscArray: array of Boolean): List<DataRow>

 

List<DataRow> sort(String[] aColumnNames, Boolean[] anAscArray)

Parameters:

  • aColumnNames: A set of column names to use during sorting.
  • anAscArray: A set of sorting directions: TRUE - for ascending sorting; FALSE- for descending.

sort (Comparator<DataRow>): List<DataRow>

Sorts the contents of the current DataTableView and returns a list of sorted rows. Comparator object is not saved internally and doesn't affect on DataTableView state.

 

method sort(aComparator: Comparator<DataRow>): List<DataRow>

 

List<DataRow> sort(Comparator<DataRow> aComparator)

Parameters:

  • aComparator: A comparator to use.

Sorting

 

property Sorting: Comparator<DataRow> read write;

 

Comparator<DataRow> Sorting { __get; __set; }

Table

 

property Table: DataTable read;

 

DataTable Table { __get; }

tableChanged  final

The method implements TableChangedListener and forces refresh of view's index if AutoRefresh property is set to TRUE.

 

method tableChanged(anEvent: TableChangedEvent)

 

void tableChanged(TableChangedEvent anEvent)

Parameters:

  • anEvent: An event occured.

 

AutoRefresh

 

property AutoRefresh: Boolean read write;

 

Boolean AutoRefresh { __get; __set; }

Count

 

property Count: Integer read;

 

Integer Count { __get; }

Row

 

property Row[aIndex: Integer]: DataRow read;

 

DataRow Row[Integer aIndex] { __get; }

Sorting

 

property Sorting: Comparator<DataRow> read write;

 

Comparator<DataRow> Sorting { __get; __set; }

Table

 

property Table: DataTable read;

 

DataTable Table { __get; }

 

constructor (DataTable)

Creates an instance of a DataTableView class tied to a given DataTable object and DataViewRowState flag set to Current.

 

constructor(aTable: DataTable)

 

DataTableView(DataTable aTable)

Parameters:

  • aTable: A table to view. IllegalArgumentException is raised if table hasn't been given.

constructor (DataTable, DataViewRowState)

Creates an instance of a DataTableView class tied to a given DataTable object using the given DataViewRowState flag.

 

constructor(aTable: DataTable; aViewRowState: DataViewRowState)

 

DataTableView(DataTable aTable, DataViewRowState aViewRowState)

Parameters:

  • aTable: A table to view. IllegalArgumentException is raised if table hasn't been given.
  • aViewRowState: A mode state of rows the newly created view will hold.

filterAndSort (Filter, String, Boolean): List<DataRow>

 

method filterAndSort(aFilter: Filter; aColumnName: String; anAsc: Boolean): List<DataRow>

 

List<DataRow> filterAndSort(Filter aFilter, String aColumnName, Boolean anAsc)

Parameters:

  • aFilter:
  • aColumnName:
  • anAsc:

filterAndSort (Filter, String[], Boolean[]): List<DataRow>

 

method filterAndSort(aFilter: Filter; aColumnNames: array of String; anAscArray: array of Boolean): List<DataRow>

 

List<DataRow> filterAndSort(Filter aFilter, String[] aColumnNames, Boolean[] anAscArray)

Parameters:

  • aFilter:
  • aColumnNames:
  • anAscArray:

filterAndSort (Filter, Comparator<DataRow>): List<DataRow>

 

method filterAndSort(aFilter: Filter; aComparator: Comparator<DataRow>): List<DataRow>

 

List<DataRow> filterAndSort(Filter aFilter, Comparator<DataRow> aComparator)

Parameters:

  • aFilter:
  • aComparator:

filterDataRows

 

method filterDataRows(aFilter: Filter): List<DataRow>

 

List<DataRow> filterDataRows(Filter aFilter)

Parameters:

  • aFilter:

getFilter

Returns the Filter used every time on a DataTableView's content refresh.

 

method getFilter: Filter

 

Filter getFilter()

group<T>

 

method group<T>(aKeyEvaluator: KeyEvaluator<T>): Map<T, List<DataRow>>

 

Map<T, List<DataRow>> group<T>(KeyEvaluator<T> aKeyEvaluator)

Parameters:

  • aKeyEvaluator:

refresh

Forses to rebuild index of the current view. Call this method when you haven't subscribed on table's events and you know, that table has been changed.

 

method refresh

 

void refresh()

setFilter

Sets a Filter to be used every time on a DataTableView's content refresh.

Note: Set it, if you want your data always be filtered according to some rule.

 

method setFilter(aValue: Filter)

 

void setFilter(Filter aValue)

Parameters:

  • aValue: The new Filter object to be set.

setSorting (String, Boolean)

This method is a helper method over Sorting property setter. It allows you to avoid creating Comparator if you want to sort the view by one column.

 

method setSorting(aColumnName: String; anAsc: Boolean)

 

void setSorting(String aColumnName, Boolean anAsc)

Parameters:

  • aColumnName: A column name to use during sorting.
  • anAsc: Direction of sorting: TRUE - for ascending sorting; FALSE- for descending.

setSorting (String[], Boolean[])

This method is a helper method over Sorting property setter. It allows you to avoid creating Comparator if you want to sort the view by several columns with no extra data manipulation.

 

method setSorting(aColumnNames: array of String; anAscArray: array of Boolean)

 

void setSorting(String[] aColumnNames, Boolean[] anAscArray)

Parameters:

  • aColumnNames: A set of column names to use during sorting.
  • anAscArray: A set of sorting directions: TRUE - for ascending sorting; FALSE- for descending.

sort (String, Boolean): List<DataRow>

This method is a helper over sort(Comparator). It allows you to avoid manually creating Comparator if you want to sort the view by single column with no extra data manipulation.

 

method sort(aColumnName: String; anAsc: Boolean): List<DataRow>

 

List<DataRow> sort(String aColumnName, Boolean anAsc)

Parameters:

  • aColumnName: A column name to use during sorting.
  • anAsc: Direction of sorting: TRUE - for ascending sorting; FALSE- for descending.

sort (String[], Boolean[]): List<DataRow>

This method is a helper over sort(Comparator). It allows you to avoid manually creating Comparator if you want to sort the view by several columns with no extra data manipulation.

 

method sort(aColumnNames: array of String; anAscArray: array of Boolean): List<DataRow>

 

List<DataRow> sort(String[] aColumnNames, Boolean[] anAscArray)

Parameters:

  • aColumnNames: A set of column names to use during sorting.
  • anAscArray: A set of sorting directions: TRUE - for ascending sorting; FALSE- for descending.

sort (Comparator<DataRow>): List<DataRow>

Sorts the contents of the current DataTableView and returns a list of sorted rows. Comparator object is not saved internally and doesn't affect on DataTableView state.

 

method sort(aComparator: Comparator<DataRow>): List<DataRow>

 

List<DataRow> sort(Comparator<DataRow> aComparator)

Parameters:

  • aComparator: A comparator to use.

tableChanged  final

The method implements TableChangedListener and forces refresh of view's index if AutoRefresh property is set to TRUE.

 

method tableChanged(anEvent: TableChangedEvent)

 

void tableChanged(TableChangedEvent anEvent)

Parameters:

  • anEvent: An event occured.