class JHtmlGrid

Utility class for creating HTML Grids

Methods

static  string
boolean( integer $i, integer $value, string $taskOn = null, string $taskOff = null)

Display a boolean setting widget.

static  string
sort( string $title, string $order, string $direction = 'asc', string $selected = '', string $task = null, string $new_direction = 'asc', string $tip = '', string $form = null)

Method to sort a column in a grid

static  string
checkall( string $name = 'checkall-toggle', string $tip = 'JGLOBAL_CHECK_ALL', string $action = 'Joomla.checkAll(this)')

Method to check all checkboxes in a grid

static  mixed
id( integer $rowNum, integer $recId, boolean $checkedOut = false, string $name = 'cid', string $stub = 'cb')

Method to create a checkbox for a grid row.

static  string
checkedOut( object $row, integer $i, string $identifier = 'id')

Displays a checked out icon.

static  string
published( mixed $value, integer $i, string $img1 = 'tick.png', string $img0 = 'publish_x.png', string $prefix = '')

Method to create a clickable icon to change the state of an item

static  string
state( string $filter_state = '*', string $published = 'JPUBLISHED', string $unpublished = 'JUNPUBLISHED', string $archived = null, string $trashed = null)

Method to create a select list of states for filtering By default the filter shows only published and unpublished items

static  string
order( array $rows, string $image = 'filesave.png', string $task = 'saveorder')

Method to create an icon for saving a new ordering in a grid

static  void
behavior()

Method to build the behavior script and add it to the document head.

Details

static string boolean( integer $i, integer $value, string $taskOn = null, string $taskOff = null)

Display a boolean setting widget.

Parameters

integer $i The row index.
integer $value The value of the boolean field.
string $taskOn Task to turn the boolean setting on.
string $taskOff Task to turn the boolean setting off.

Return Value

string The boolean setting widget.

static string sort( string $title, string $order, string $direction = 'asc', string $selected = '', string $task = null, string $new_direction = 'asc', string $tip = '', string $form = null)

Method to sort a column in a grid

Parameters

string $title The link title
string $order The order field for the column
string $direction The current direction
string $selected The selected ordering
string $task An optional task override
string $new_direction An optional direction for the new column
string $tip An optional text shown as tooltip title instead of $title
string $form An optional form selector

Return Value

string

static string checkall( string $name = 'checkall-toggle', string $tip = 'JGLOBAL_CHECK_ALL', string $action = 'Joomla.checkAll(this)')

Method to check all checkboxes in a grid

Parameters

string $name The name of the form element
string $tip The text shown as tooltip title instead of $tip
string $action The action to perform on clicking the checkbox

Return Value

string

static mixed id( integer $rowNum, integer $recId, boolean $checkedOut = false, string $name = 'cid', string $stub = 'cb')

Method to create a checkbox for a grid row.

Parameters

integer $rowNum The row index
integer $recId The record id
boolean $checkedOut True if item is checked out
string $name The name of the form element
string $stub The name of stub identifier

Return Value

mixed String of html with a checkbox if item is not checked out, null if checked out.

static string checkedOut( object $row, integer $i, string $identifier = 'id')

Displays a checked out icon.

Parameters

object $row &$row A data object (must contain checkedout as a property).
integer $i The index of the row.
string $identifier The property name of the primary key or index of the row.

Return Value

string

static string published( mixed $value, integer $i, string $img1 = 'tick.png', string $img0 = 'publish_x.png', string $prefix = '')

Method to create a clickable icon to change the state of an item

Parameters

mixed $value Either the scalar value or an object (for backward compatibility, deprecated)
integer $i The index
string $img1 Image for a positive or on value
string $img0 Image for the empty or off value
string $prefix An optional prefix for the task

Return Value

string

static string state( string $filter_state = '*', string $published = 'JPUBLISHED', string $unpublished = 'JUNPUBLISHED', string $archived = null, string $trashed = null)

Method to create a select list of states for filtering By default the filter shows only published and unpublished items

Parameters

string $filter_state The initial filter state
string $published The JText string for published
string $unpublished The JText string for Unpublished
string $archived The JText string for Archived
string $trashed The JText string for Trashed

Return Value

string

static string order( array $rows, string $image = 'filesave.png', string $task = 'saveorder')

Method to create an icon for saving a new ordering in a grid

Parameters

array $rows The array of rows of rows
string $image The image [UNUSED]
string $task The task to use, defaults to save order

Return Value

string

static void behavior()

Method to build the behavior script and add it to the document head.

Return Value

void