Skip to content

classes_lib_controls_table_table.class

Daniel Spors edited this page Dec 19, 2023 · 3 revisions

Classes in file lib/controls/table/table.class.php

class Table

An HTML table in DIV notation.

Extends: Control » Renderable

Subclasses: DatabaseTable, uiTable

AddDataToRow

Adds a data object to the current row. This will be stored for AJAX acceess

Definition: public function AddDataToRow($model)

Returns: static

Parameters:

  • mixed $model Data object

AddNewRow

Adds a new row, takes all arguments given and uses each as new data-cell.

Definition: public function AddNewRow($args)

Returns: static

Parameters:

  • mixed $args Values for the new row

AddNewRowGroup

Same as NewRowGroup($options) but returns $this to allow method chaining.

Definition: public function AddNewRowGroup($options=false)

Returns: static

Parameters:

  • array $options See TBody for options

AddPager

Adds a Pager to the table Will be displayed in the tables footer. See Table::SetDataCallback for details how to add data to a paged table.

Definition: public function AddPager($items_per_page, $current_page=false, $max_pages_to_show, $toomany)

Returns: static

Parameters:

  • int $items_per_page Items per page to be displayed

  • int $current_page One (1) based index of current page

  • int $max_pages_to_show Maximum links to pages to be shown

  • mixed $toomany Catches cases where deprecated method structure is used in call. If present raises an exception.

AddRowAction

Adds an action to the current row. This is in fact a little icon displayed on hovering the row. Clicking on it will trigger an AJAX action.

Definition: public function AddRowAction($icon, $label, $handler=false, $method=false)

Returns: static

Parameters:

  • string $icon Valid uiControl::Icon

  • string $label Action label (alt and tootltip text)

  • object|string $handler Object handling the action

  • string $method Objects method that handles the action

Clear

Clears the complete table.

Definition: public function Clear()

Returns: static

ColGroup

Gets the ColGroup definition Creates one if needed.

Definition: public function ColGroup()

Returns: ColGroup The tables ColGroup object

Footer

Gets the table footer. Creates one if needed.

Definition: public function Footer($clear=false)

Returns: TFoot The tables footer

Parameters:

  • bool $clear If true deleted previously set footer

GetColFormat

Gets the CellFormat for a column.

Definition: public function GetColFormat($index)

Returns: CellFormat The CellFormat object

Parameters:

  • int $index Zero based column index

GetCurrentRow

Returns the current row, if any.

Definition: public function GetCurrentRow()

Returns: Tr The current row object or false

GetRowModel

Gets the model for a specific row id. Note that $row_id is the id of the Tr object, not the index in the row listing!

Definition: public function GetRowModel($row_id)

Returns: mixed The data object

Parameters:

  • string $row_id Id of the Tr object

GotoPage

INTERNAL Will be polled via AJAX to change the page if you defined a pager using DatabaseTable

Header

Gets the table header. Creates one if needed.

Definition: public function Header()

Returns: THead The tables header

NewCell

Creates a new cell New row will be created if there's not one already.

Definition: public function NewCell($content=false)

Returns: Td The new Td object

Parameters:

  • mixed $content Content to be added to the cell automatically

NewRow

Creates a new row. Will be added to the current row group (which wis created if none yet).

Definition: public function NewRow($data=false, $options=false)

Returns: Tr The new Tr object

Parameters:

  • array $data Data to be added to the row automatically

  • array $options Rows options, see TBody::NewRow

NewRowGroup

Creates a new row group and sets it the current Newly created rows will then be added to this group.

Definition: public function NewRowGroup($options=false)

Returns: TBody The row group

Parameters:

  • array $options See TBody for options

OnActionClicked

INTERNAL Handles row action clicks and calls the defined handlers (Table::AddRowAction)

OnReordered

INTERNAL Handles the sort-drop event and calls the hanlder (Table::Sortable)

Persist

Store this tables current page in the Session.

Definition: public function Persist($name, $storage=null)

Returns: static

Parameters:

  • string $name A (session-)unique name for the table

  • \ScavixWDF\WdfBuffer $storage Optional external Buffer to use a storage container

PreRender

OVERRIDE Control::PreRender

ResetPager

Resets the current page to be the first.

Definition: public function ResetPager()

Returns: static

SetAlignment

Takes one argument for each (previously set) column possible values: l, r, c (or: left, right, center) as strings sample $tab->SetAlignment('l','l','c','r') when there are 4+ columns to skip a column just pass an empty string: $tab->SetAlignment('l','','','r')

Definition: public function SetAlignment($args)

Returns: static

Parameters:

  • mixed $args Alignement values

SetCaption

Just sets the caption.

Definition: public function SetCaption($cap)

Returns: static

Parameters:

  • string $cap Caption text

SetColFormat

Sets the format for a specific column.

Definition: public function SetColFormat($index, $format, $blank_if_false=false, $conditional_css)

Returns: static

Parameters:

  • int $index Zero based column index

  • string $format See CellFormat for explanation

  • bool $blank_if_false If shall be empty if content is false (that may be 0 or '' too)

  • array $conditional_css See CellFormat for explanation

SetCulture

Just sets the culture. This will be used when value are formatted using a CellFormat specified via Table::SetColFormat or Table::SetFormat

Definition: public function SetCulture($ci)

Returns: static

Parameters:

  • CultureInfo $ci CultureInfo object speficying the culture

SetDataCallback

Sets a handler to be called whenever the table needs data. Use this in conjuction with Table::AddPager to generate dynamic data.

Definition: public function SetDataCallback($handler, $method)

Returns: static

Parameters:

  • object $handler Object that will handle the request.

  • string $method Name of the method to be called

SetFooter

Takes all arguments given and uses each as cell-value to add a footer row.

Definition: public function SetFooter($args)

Returns: static

Parameters:

  • mixed $args Cell-values

SetFormat

Takes one argument for each (previously set) column possible values: see CellFormat class sample $tab->SetFormat('int','f2') when there are 2+ columns to skip a column just pass an empty string: $tab->SetFormat('int','','','f2')

Definition: public function SetFormat($args)

Returns: static

Parameters:

  • mixed $args Format values

SetHeader

Takes all arguments given and uses each as row-title.

Definition: public function SetHeader($args)

Returns: static

Parameters:

  • mixed $args Titles

SetStorage

Sets the storage container.

Definition: public function SetStorage($storage)

Returns: void

Parameters:

  • \ScavixWDF\WdfBuffer $storage Buffer to be used as storage

Sortable

Sets a sort handler for this table Note: this does not mean that the data can be sorted for display, but that the user may rearrange the rows via mouse drag and drop!

Definition: public function Sortable($handler, $method)

Returns: static

Parameters:

  • object $handler Object handling the drop

  • string $method Method to be called

WdfRender

OVERRIDE Control::WdfRender

__construct

Definition: public function __construct()

Returns: NOT DOCUMENTED

Clone this wiki locally