doc/src/ComponentReference/contrib.Table.html [95:210]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Providing the data

There are many ways to provide the component with the data it has to render, but here are the three major ones:

  1. The data is passed to the source parameter in the form of an array, a collection, or an iterator, and the table columns are defined using the columns parameter (see further for details). Both of these parameters will be evaluated at every request by default, so changes in the data or the table columns will be displayed immediately.

    The example below uses this method.

    This is the easiest and most straightforward approach. It has one performance limitation, however - if the table is sorting the data according to a given column, the sorting will be performed at every request. The next methods provide ways to resolve this possible performance issue.

  2. The data is passed to the source parameter via an object that implements the IBasicTableModel interface. Through that interface you are given the sorting column (if any) and the numbers of the items that will be displayed on the current page. You then need to provide the component with the corresponding data.

    This method allows you to perform the sorting in the database and load only the data that will be displayed on the current page (e.g. by using the ORDER BY, LIMIT, and OFFSET clauses in SQL) and hence it could be far more efficient.

  3. All of the information (data, columns, state) is packaged in an ITableModel and is passed to the tableModel parameter.

    This approach allows greatest flexibility, but is recommended only for advanced users of the Table components.

Defining the columns

If you define the table columns using the columns parameter, you can either provide a list of ITableColumn objects, each defining a column in the table, or you can define the columns using a string that describes each column.

Please see the example below as a demonstration of the use of the latter approach.

The string describing the columns must be formatted in the following way:

Here is an example of the use of a description string to define columns:

  columns="locale:toString(), =currencyColumn, verbosity:Verbosity:currentRowVerbosity, !delete"

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - doc/src/ComponentReference/contrib.TableView.html [80:194]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Providing the data

There are many ways to provide the component with the data it has to render, but here are the three major ones:

  1. The data is passed to the source parameter in the form of an array, a collection, or an iterator, and the table columns are defined using the columns parameter (see further for details). Both of these parameters will be evaluated at every request by default, so changes in the data or the table columns will be displayed immediately.

    The example below uses this method.

    This is the easiest and most straightforward approach. It has one performance limitation, however - if the table is sorting the data according to a given column, the sorting will be performed at every request. The next methods provide ways to resolve this possible performance issue.

  2. The data is passed to the source parameter via an object that implements the IBasicTableModel interface. Through that interface you are given the sorting column (if any) and the numbers of the items that will be displayed on the current page. You then need to provide the component with the corresponding data.

    This method allows you to perform the sorting in the database and load only the data that will be displayed on the current page (e.g. by using the ORDER BY, LIMIT, and OFFSET clauses in SQL) and hence it could be far more efficient.

  3. All of the information (data, columns, state) is packaged in an ITableModel and is passed to the tableModel parameter.

    This approach allows greatest flexibility, but is recommended only for advanced users of the Table components.

Defining the columns

If you define the table columns using the columns parameter, you can either provide a list of ITableColumn objects, each defining a column in the table, or you can define the columns using a string that describes each column.

Please see the example below as a demonstration of the use of the latter approach.

The string describing the columns must be formatted in the following way:

Here is an example of the use of a description string to define columns:

  columns="locale:toString(), =currencyColumn, verbosity:Verbosity:currentRowVerbosity, !delete"

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -