class KeyValueGrid extends Grid (View source)

The KeyValueGrid class.

Constants

ROW_HEAD

ROW_FOOT

ROW_NORMAL

COL_KEY

COL_VALUE

ROW

Methods

__construct(array $attribs = array())

Class init.

static Grid
create(array $attribs = array())

create

string
__toString()

Magic function to render this object as a table.

from Grid
setTableAttributes(array $attribs = array(), bool $replace = false)

Method to set the attributes for a table-tag

from Grid
array
getTableAttributes()

Get the Attributes of the current table

from Grid
addColumn(string $name)

Add new column name to process

from Grid
array
getColumns()

Returns the list of internal columns

from Grid
deleteColumn(string $name)

Delete column by name

from Grid
setColumns(array $columns)

Method to set a whole range of columns at once This can be used to re-order the columns, too

from Grid
addRow(array $attribs = array(), int|bool $special = self::ROW_NORMAL)

Adds a row to the table and sets the currently active row to the new row

from Grid
array
getRowAttributes()

Method to get the attributes of the currently active row

from Grid
setRowAttributes(array $attribs)

Method to set the attributes of the currently active row

from Grid
int
getActiveRow()

Get the currently active row ID

from Grid
setActiveRow(int $id)

Set the currently active row

from Grid
setRowCell(string $name, string $content, array $attribs = array(), bool $replace = true)

Set cell content for a specific column for the currently active row

from Grid
array
getRow(int|bool $id = false)

Get all data for a row

from Grid
array
getRows(int|bool $special = false)

Get the IDs of all rows in the table

from Grid
deleteRow(int $id)

Delete a row from the object

from Grid
string
toString()

Render the HTML table

from Grid
addHeader(string $keyTitle = 'Key', string $valueTitle = 'Value', array $attribs = array())

addHeader

addItem(string $key, string $value = null, array $attribs = array())

addItem

addItems(string $items = null, array $attribs = array())

addItems

addTitle(string $name, array $attribs = array())

addTitle

configure(array $items, callable $handler)

configureRows

Details

at line line 39
__construct(array $attribs = array())

Class init.

Parameters

array $attribs Associative array of attributes for the table-tag

at line line 29
static Grid create(array $attribs = array())

create

Parameters

array $attribs

Return Value

Grid

in Grid at line line 87
string __toString()

Magic function to render this object as a table.

Return Value

string

in Grid at line line 109
Grid setTableAttributes(array $attribs = array(), bool $replace = false)

Method to set the attributes for a table-tag

Parameters

array $attribs Associative array of attributes for the table-tag
bool $replace Replace possibly existing attributes

Return Value

Grid This object for chaining

in Grid at line line 130
array getTableAttributes()

Get the Attributes of the current table

Return Value

array Associative array of attributes

in Grid at line line 144
Grid addColumn(string $name)

Add new column name to process

Parameters

string $name Internal column name

Return Value

Grid This object for chaining

in Grid at line line 158
array getColumns()

Returns the list of internal columns

Return Value

array List of internal columns

in Grid at line line 172
Grid deleteColumn(string $name)

Delete column by name

Parameters

string $name Name of the column to be deleted

Return Value

Grid This object for chaining

in Grid at line line 195
Grid setColumns(array $columns)

Method to set a whole range of columns at once This can be used to re-order the columns, too

Parameters

array $columns List of internal column names

Return Value

Grid This object for chaining

in Grid at line line 213
Grid addRow(array $attribs = array(), int|bool $special = self::ROW_NORMAL)

Adds a row to the table and sets the currently active row to the new row

Parameters

array $attribs Associative array of attributes for the row
int|bool $special 1 for a new row in the header, 2 for a new row in the footer

Return Value

Grid This object for chaining

in Grid at line line 240
array getRowAttributes()

Method to get the attributes of the currently active row

Return Value

array Associative array of attributes

in Grid at line line 254
Grid setRowAttributes(array $attribs)

Method to set the attributes of the currently active row

Parameters

array $attribs Associative array of attributes

Return Value

Grid This object for chaining

in Grid at line line 268
int getActiveRow()

Get the currently active row ID

Return Value

int ID of the currently active row

in Grid at line line 282
Grid setActiveRow(int $id)

Set the currently active row

Parameters

int $id ID of the row to be set to current

Return Value

Grid This object for chaining

in Grid at line line 302
Grid setRowCell(string $name, string $content, array $attribs = array(), bool $replace = true)

Set cell content for a specific column for the currently active row

Parameters

string $name Name of the column
string $content Content for the cell
array $attribs Associative array of attributes for the td-element
bool $replace If false, the content is appended to the current content of the cell

Return Value

Grid This object for chaining

in Grid at line line 329
array getRow(int|bool $id = false)

Get all data for a row

Parameters

int|bool $id ID of the row to return

Return Value

array Array of columns of a table row

in Grid at line line 355
array getRows(int|bool $special = false)

Get the IDs of all rows in the table

Parameters

int|bool $special false for the standard rows, 1 for the header rows, 2 for the footer rows

Return Value

array Array of IDs

in Grid at line line 381
Grid deleteRow(int $id)

Delete a row from the object

Parameters

int $id ID of the row to be deleted

Return Value

Grid This object for chaining

in Grid at line line 411
string toString()

Render the HTML table

Return Value

string The rendered HTML table

at line line 55
KeyValueGrid addHeader(string $keyTitle = 'Key', string $valueTitle = 'Value', array $attribs = array())

addHeader

Parameters

string $keyTitle
string $valueTitle
array $attribs

Return Value

KeyValueGrid

at line line 73
KeyValueGrid addItem(string $key, string $value = null, array $attribs = array())

addItem

Parameters

string $key
string $value
array $attribs

Return Value

KeyValueGrid

at line line 99
KeyValueGrid addItems(string $items = null, array $attribs = array())

addItems

Parameters

string $items
array $attribs

Return Value

KeyValueGrid

at line line 117
KeyValueGrid addTitle(string $name, array $attribs = array())

addTitle

Parameters

string $name
array $attribs

Return Value

KeyValueGrid

at line line 134
KeyValueGrid configure(array $items, callable $handler)

configureRows

Parameters

array $items
callable $handler

Return Value

KeyValueGrid