JGrid

JGrid class to dynamically generate HTML tables

package

Joomla.Platform

subpackage

HTML

since

11.3

Methods

__construct

Constructor for a JGrid object

__construct(array $options = array()) 
since

11.3

Arguments

$options

arrayAssociative array of attributes for the table-tag

__toString

Magic function to render this object as a table.

__toString() : string
since

11.3

Response

string

addColumn

Add new column name to process

addColumn(string $name) : \JGrid
since

11.3

Arguments

$name

stringInternal column name

Response

\JGridThis object for chaining

addRow

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

addRow(array $options = array(), integer $special = false) : \JGrid
since

11.3

Arguments

$options

arrayAssociative array of attributes for the row

$special

integer1 for a new row in the header, 2 for a new row in the footer

Response

\JGridThis object for chaining

deleteColumn

Delete column by name

deleteColumn(string $name) : \JGrid
since

11.3

Arguments

$name

stringName of the column to be deleted

Response

\JGridThis object for chaining

deleteRow

Delete a row from the object

deleteRow(integer $id) : \JGrid
since

11.3

Arguments

$id

integerID of the row to be deleted

Response

\JGridThis object for chaining

getActiveRow

Get the currently active row ID

getActiveRow() : integer
since

11.3

Response

integerID of the currently active row

getColumns

Returns the list of internal columns

getColumns() : array
since

11.3

Response

arrayList of internal columns

getRow

Get all data for a row

getRow(integer $id = false) : array
since

11.3

Arguments

$id

integerID of the row to return

Response

arrayArray of columns of a table row

getRowOptions

Method to get the attributes of the currently active row

getRowOptions() : array
since

11.3

Response

arrayAssociative array of attributes

getRows

Get the IDs of all rows in the table

getRows(integer $special = false) : array
since

11.3

Arguments

$special

integerfalse for the standard rows, 1 for the header rows, 2 for the footer rows

Response

arrayArray of IDs

getTableOptions

Get the Attributes of the current table

getTableOptions() : array
since

11.3

Response

arrayAssociative array of attributes

renderArea

Render an area of the table

renderArea(array $ids, string $area = 'tbody', string $cell = 'td') : string
since

11.3

Arguments

$ids

arrayIDs of the rows to render

$area

stringName of the area to render. Valid: tbody, tfoot, thead

$cell

stringName of the cell to render. Valid: td, th

Response

stringThe rendered table area

renderAttributes

Renders an HTML attribute from an associative array

renderAttributes(array $attributes) : string
since

11.3

Arguments

$attributes

arrayAssociative array of attributes

Response

stringThe HTML attribute string

setActiveRow

Set the currently active row

setActiveRow(integer $id) : \JGrid
since

11.3

Arguments

$id

integerID of the row to be set to current

Response

\JGridThis object for chaining

setColumns

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

setColumns(array $columns) : \JGrid
since

11.3

Arguments

$columns

arrayList of internal column names

Response

\JGridThis object for chaining

setRowCell

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

setRowCell(string $name, string $content, array $option = array(), boolean $replace = true) : \JGrid
since

11.3

Arguments

$name

stringName of the column

$content

stringContent for the cell

$option

arrayAssociative array of attributes for the td-element

$replace

booleanIf false, the content is appended to the current content of the cell

Response

\JGridThis object for chaining

setRowOptions

Method to set the attributes of the currently active row

setRowOptions(array $options) : \JGrid
since

11.3

Arguments

$options

arrayAssociative array of attributes

Response

\JGridThis object for chaining

setTableOptions

Method to set the attributes for a table-tag

setTableOptions(array $options = array(), boolean $replace = false) : \JGrid
since

11.3

Arguments

$options

arrayAssociative array of attributes for the table-tag

$replace

booleanReplace possibly existing attributes

Response

\JGridThis object for chaining

toString

Render the HTML table

toString() : string
since

11.3

Response

stringThe rendered HTML table

Properties

columns

Array of columns

since

11.3

Type(s)

array

activeRow

Current active row

since

11.3

Type(s)

integer

rows

Rows of the table (including header and footer rows)

since

11.3

Type(s)

array

specialRows

Header and Footer row-IDs

since

11.3

Type(s)

array

options

Associative array of attributes for the table-tag

since

11.3

Type(s)

array