Cascade Core  v0.12-1-g22cbbeb
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
TableView Class Reference

Simple table view. More...

Public Member Functions

 __construct ()
 Constructor.
 
 addColumn ($type, $opts)
 Add column to table. More...
 
 columns ()
 Get columns added by addColumn(). More...
 
 addAction ($name, $opts)
 Add action button.
 
 getActions ()
 Get all actions added with addAction().
 
 setTableClass ($class)
 Set class attribute of the table.
 
 getTableClass ()
 Get class attribute of the table.
 
 setRowClass ($class)
 Set class attribute of each row.
 
 getRowClass ()
 Get class attribute of each row.
 
 setDataIteratorFunction ($iterator_object, $iterator_func)
 Set iterator object as data source. More...
 
 setData ($data)
 Set array as data source. More...
 
 getNextRowData ()
 Get next row from data source (used by template).
 

Public Attributes

 $show_header = true
 Show table header?
 
 $show_footer = false
 Show table footer?
 
 $row_data
 Callable which returns array of data attributes of <tr> tag. More...
 

Detailed Description

Simple table view.

Renders list of items into predefined table.

Member Function Documentation

addColumn (   $type,
  $opts 
)

Add column to table.

$type sets template used to render the column, $opts are passed to the template.

Here is the call graph for this function:

columns ( )

Get columns added by addColumn().

/

Todo:
Rename to getColumns.

Here is the caller graph for this function:

setDataIteratorFunction (   $iterator_object,
  $iterator_func 
)

Set iterator object as data source.

To retrieve next row the $iterator_object->$iterator_func() is called.

setData (   $data)

Set array as data source.

One item in array is one row in table.

Member Data Documentation

$row_data

Callable which returns array of data attributes of <tr> tag.

Returns array($k => $v), which will be added to <tr> element as data-$k="$v".