Piwik\DataTable\Filter\

Sort

Sorts a DataTable based on the value of a specific column.

It is possible to specify a natural sorting (see php.net/natsort for details).

Methods

The class defines the following methods:

__construct()

Constructor.

Signature

  • It accepts the following parameter(s):
    • $table (DataTable) — The table to eventually filter.
    • $columnToSort (string) — The name of the column to sort by.
    • $order (string) — order 'asc' or 'desc'.
    • $naturalSort (bool) — Whether to use a natural sort or not (see http://php.net/natsort).
    • $recursiveSort (bool) — Whether to sort all subtables or not.
    • $doSortBySecondaryColumn (bool|Piwik\DataTable\Filter\callback) — If true will sort by a secondary column. The column is automatically detected and will be either nb_visits or label, if possible. If callback given it will sort by the column returned by the callback (if any) callback will be called with 2 parameters: primaryColumnToSort and table

filter()

See Sort.

Signature

  • It accepts the following parameter(s):

  • It returns a mixed value.

enableRecursive()

Enables/Disables recursive filtering.

Whether this property is actually used is up to the derived BaseFilter class.

Signature

  • It accepts the following parameter(s):

    • $enable (bool) —
  • It does not return anything.

filterSubTable()

Filters a row's subtable, if one exists and is loaded in memory.

Signature

  • It accepts the following parameter(s):
    • $row (Row) — The row whose subtable should be filter.
  • It does not return anything.