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
array
Associative 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
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
array
Associative array of attributes for the row- $special
integer
1 for a new row in the header, 2 for a new row in the footer
Response
\JGrid
This object for chaining
deleteColumn
Delete column by name
deleteColumn(string $name) : \JGrid
since |
11.3 |
---|
Arguments
- $name
string
Name of the column to be deleted
Response
\JGrid
This object for chaining
deleteRow
Delete a row from the object
deleteRow(integer $id) : \JGrid
getActiveRow
Get the currently active row ID
getActiveRow() : integer
since |
11.3 |
---|
Response
integer
ID of the currently active row
getColumns
Returns the list of internal columns
getColumns() : array
since |
11.3 |
---|
Response
array
List of internal columns
getRow
Get all data for a row
getRow(integer $id = false) : array
since |
11.3 |
---|
Arguments
- $id
integer
ID of the row to return
Response
array
Array of columns of a table row
getRowOptions
Method to get the attributes of the currently active row
getRowOptions() : array
since |
11.3 |
---|
Response
array
Associative array of attributes
getRows
Get the IDs of all rows in the table
getRows(integer $special = false) : array
since |
11.3 |
---|
Arguments
- $special
integer
false for the standard rows, 1 for the header rows, 2 for the footer rows
Response
array
Array of IDs
getTableOptions
Get the Attributes of the current table
getTableOptions() : array
since |
11.3 |
---|
Response
array
Associative 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
array
IDs of the rows to render- $area
string
Name of the area to render. Valid: tbody, tfoot, thead- $cell
string
Name of the cell to render. Valid: td, th
Response
string
The rendered table area
renderAttributes
Renders an HTML attribute from an associative array
renderAttributes(array $attributes) : string
since |
11.3 |
---|
Arguments
- $attributes
array
Associative array of attributes
Response
string
The HTML attribute string
setActiveRow
Set the currently active row
setActiveRow(integer $id) : \JGrid
since |
11.3 |
---|
Arguments
- $id
integer
ID of the row to be set to current
Response
\JGrid
This 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
array
List of internal column names
Response
\JGrid
This 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
string
Name of the column- $content
string
Content for the cell- $option
array
Associative array of attributes for the td-element- $replace
boolean
If false, the content is appended to the current content of the cell
Response
\JGrid
This object for chaining
setRowOptions
Method to set the attributes of the currently active row
setRowOptions(array $options) : \JGrid
since |
11.3 |
---|
Arguments
- $options
array
Associative array of attributes
Response
\JGrid
This 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
array
Associative array of attributes for the table-tag- $replace
boolean
Replace possibly existing attributes
Response
\JGrid
This object for chaining
toString
Render the HTML table
toString() : string
since |
11.3 |
---|
Response
string
The 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