The PivotTableHelper class provides support for configuring display tables (DataListViews and GroupedDataListViews) dynamically, based upon the structure of a pivot query.
More...
|
| __construct ($pivot, $table) |
| Creates a new PivotTableHelper. More...
|
|
| column ($pattern, $format, $sortable=true, $style="", $typeHint=null, $onExport=null, $sortFormat=null, $footerTotal=false) |
| Adds a column specification. More...
|
|
| create () |
| Adds columns to the table based on the column specifications that have been provided. More...
|
|
The PivotTableHelper class provides support for configuring display tables (DataListViews and GroupedDataListViews) dynamically, based upon the structure of a pivot query.
- Author
- Andy Green
Definition at line 631 of file pivot.inc.
◆ __construct()
PivotTableHelper::__construct |
( |
|
$pivot, |
|
|
|
$table |
|
) |
| |
◆ column()
PivotTableHelper::column |
( |
|
$pattern, |
|
|
|
$format, |
|
|
|
$sortable = true , |
|
|
|
$style = "" , |
|
|
|
$typeHint = null , |
|
|
|
$onExport = null , |
|
|
|
$sortFormat = null , |
|
|
|
$footerTotal = false |
|
) |
| |
Adds a column specification.
Column specifications match fields by regular expression and provide the output format, styles and hints for the generated columns.
- Parameters
-
string | $pattern | The field matching pattern |
string | $format | The output format template |
boolean | $sortable | Whether the column is sortable (optional) |
string | $style | CSS styles for the column (optional) |
string | $typeHint | Type hint for the column (optional) |
string | $onExport | Data export callback for the column (optional) |
string | $sortFormat | sorting format for the column (optional) |
- Returns
- PivotTableHelper
Definition at line 661 of file pivot.inc.
663 $this->columnSpecs[$pattern] = array(
"format" => $format,
"sortable" => $sortable,
"style" => $style,
664 "typeHint" => $typeHint,
"onExport" => $onExport,
"sortFormat" => $sortFormat,
665 "footerTotal" => $footerTotal);
◆ create()
PivotTableHelper::create |
( |
| ) |
|
Adds columns to the table based on the column specifications that have been provided.
Definition at line 672 of file pivot.inc.
674 $item = $this->pivot->createPivotItem();
676 $fields = $item->getFields();
678 foreach($fields as $field => $type)
680 foreach($this->columnSpecs as $spec => $details)
683 if (preg_match(
"/{$spec}/", $field, $matches))
685 $format = str_replace(
"%FIELD%", $field, $details[
"format"]);
687 if ($matches[1]) $format = str_replace(
"%KEY%", $matches[1], $format);
689 $this->table->column($item->prettifyFieldName($field), $format, $details[
"sortable"], $details[
"style"],
690 $details[
"typeHint"], $details[
"onExport"], $details[
"sortFormat"]);
691 if ($details[
"footerTotal"])
693 $this->table->footerTotal($format);
◆ $columnSpecs
PivotTableHelper::$columnSpecs = array() |
◆ $pivot
◆ $table
The documentation for this class was generated from the following file: