Framework  3.9
DataColumn Class Reference

Represents a column in a DataListView output table. More...

Public Member Functions

 DataColumn ($title, $template, $sortable=true, $style=null, $typeHint=null, $onExport=null, $sortFormat=null)
 Creates a new DataColumn. More...
 
 format ($row)
 Outputs the text for the column using the given row. More...
 

Public Attributes

 $template
 The formatting template or formatter function for this data column. More...
 
 $sortable
 Boolean value indicating whether this column is sortable. More...
 
 $title
 The title text for this column. More...
 
 $style
 Any CSS styles to be applied to this column. More...
 
 $typeHint
 Hint to the Excel formatter about the data type to export. More...
 
 $onExport
 Optional user callback function for exporting the column. More...
 
 $sortFormat
 Optional explicit format to use as the basis for sorting. More...
 
 $exportOnly = false
 Boolean value indicating that the column should only be rendered when exporting to Excel. More...
 

Detailed Description

Represents a column in a DataListView output table.

Author
Andy Green

Definition at line 38 of file data_column.inc.

Member Function Documentation

◆ DataColumn()

DataColumn::DataColumn (   $title,
  $template,
  $sortable = true,
  $style = null,
  $typeHint = null,
  $onExport = null,
  $sortFormat = null 
)

Creates a new DataColumn.

Generally this function should not be invoked directly, but should be accessed through the DataListView::column() method.

Parameters
string$titlethe title for the colum
mixed$templatethe formatting template or formatter function for the column
boolean$sortableboolean indicating whether the column is sortable
string$styleany CSS styles to be appled to the column
string$typeHinthint for cell type to use when exporting to Excel
mixed$onExportoptional callback function to format value for Excel
string$sortFormatOptional explicit format to use as the basis for sorting
Returns
DataColumn a new DataColumn instance

Definition at line 62 of file data_column.inc.

63  {
64  $this->template = $template;
65  $this->sortable = $sortable;
66  $this->title = $title;
67  $this->style = $style;
68  $this->typeHint = $typeHint;
69  $this->onExport = $onExport;
70  $this->sortFormat = $sortFormat;
71  }
$template
The formatting template or formatter function for this data column.
Definition: data_column.inc:40
$sortFormat
Optional explicit format to use as the basis for sorting.
Definition: data_column.inc:46
$sortable
Boolean value indicating whether this column is sortable.
Definition: data_column.inc:41
$style
Any CSS styles to be applied to this column.
Definition: data_column.inc:43
$onExport
Optional user callback function for exporting the column.
Definition: data_column.inc:45
$typeHint
Hint to the Excel formatter about the data type to export.
Definition: data_column.inc:44
$title
The title text for this column.
Definition: data_column.inc:42

◆ format()

DataColumn::format (   $row)

Outputs the text for the column using the given row.

This function should not be invoked directly, but is invoked as part of the DataListView's rendering operations.

Parameters
$rowthe object for the row being rendered
Returns
string the contents of the rendered cell.

Definition at line 79 of file data_column.inc.

80  {
81  if (is_callable($this->template))
82  {
83  return call_user_func($this->template, $row);
84  }
85  else return $row->format($this->template);
86  }

Member Data Documentation

◆ $exportOnly

DataColumn::$exportOnly = false

Boolean value indicating that the column should only be rendered when exporting to Excel.

Definition at line 47 of file data_column.inc.

◆ $onExport

DataColumn::$onExport

Optional user callback function for exporting the column.

Definition at line 45 of file data_column.inc.

◆ $sortable

DataColumn::$sortable

Boolean value indicating whether this column is sortable.

Definition at line 41 of file data_column.inc.

◆ $sortFormat

DataColumn::$sortFormat

Optional explicit format to use as the basis for sorting.

Definition at line 46 of file data_column.inc.

◆ $style

DataColumn::$style

Any CSS styles to be applied to this column.

Definition at line 43 of file data_column.inc.

◆ $template

DataColumn::$template

The formatting template or formatter function for this data column.

Definition at line 40 of file data_column.inc.

◆ $title

DataColumn::$title

The title text for this column.

Definition at line 42 of file data_column.inc.

◆ $typeHint

DataColumn::$typeHint

Hint to the Excel formatter about the data type to export.

Definition at line 44 of file data_column.inc.


The documentation for this class was generated from the following file: