PHP Class WhToggleColumn

Author: Antonio Ramirez ([email protected])
Inheritance: extends TbDataColumn
Mostra file Open project: 2amigos/yiiwheels

Public Properties

Property Type Description
$afterToggle a javascript function that will be invoked after the toggle ajax call. The function signature is function(data)
  • success status of the ajax call, true if the ajax call was successful, false if the ajax call failed.
  • data the data returned by the server in case of a successful call or XHR object in case of error.
Note that if success is true it does not mean that the delete was successful, it only means that the ajax call was successful. Example:
 array(
    class'=>'TbToggleColumn',
    'afterToggle'=>'function(success,data){ if (success) alert("Toggled successfuly"); }',
 ),
$checkedButtonLabel the label for the toggle button. Defaults to "Check". Note that the label will not be HTML-encoded when rendering.
$checkedIcon the glyph icon toggle button "checked" state. You may set this property to be false to render a text link instead.
$displayText display button with text or only icon with label tooltip
$emptyButtonLabel the label for the NULL value toggle button. Defaults to "Not Set". Note that the label will not be HTML-encoded when rendering.
$emptyIcon the glyph icon toggle button "empty" state (example for null value)
$filter the HTML code representing a filter input (eg a text field, a dropdown list) that is used for this data column. This property is effective only when {@link CGridView::filter} is set. If this property is not set, a text field will be generated as the filter input; If this property is an array, a dropdown list will be generated that uses this property value as the list options. If you don't want a filter for this data column, set this value to false.
$footerHtmlOptions the HTML options for the footer cell tag.
$headerHtmlOptions the HTML options for the header cell tag.
$htmlOptions the HTML options for the data cell tags.
$name the attribute name of the data model. Used for column sorting, filtering and to render the corresponding attribute value in each data cell. If {@link value} is specified it will be used to rendered the data cell instead of the attribute value.
$sortable whether the column is sortable. If so, the header cell will contain a link that may trigger the sorting. Defaults to true. Note that if {@link name} is not set, or if {@link name} is not allowed by {@link CSort}, this property will be treated as false.
$toggleAction Name of the action to call and toggle values
$uncheckedButtonLabel the label for the toggle button. Defaults to "Uncheck". Note that the label will not be HTML-encoded when rendering.
$uncheckedIcon the glyph icon toggle button "unchecked" state. You may set this property to be false to render a text link instead.
$uniqueClassSuffix suffix substituted to a name class of the tag

Protected Properties

Property Type Description
$toggleOptions the configuration for toggle button.

Public Methods

Method Description
init ( ) Initializes the column.

Protected Methods

Method Description
initButton ( ) Initializes the default buttons (toggle).
registerClientScript ( ) Registers the client scripts for the button column.
renderDataCellContent ( integer $row, mixed $data ) Renders the data cell content.

Private Methods

Method Description
getButtonLabel ( $value ) : string Returns the button label

Method Details

init() public method

This method registers necessary client script for the button column.
public init ( )

initButton() protected method

Initializes the default buttons (toggle).
protected initButton ( )

registerClientScript() protected method

Registers the client scripts for the button column.
protected registerClientScript ( )

renderDataCellContent() protected method

This method renders the view, update and toggle buttons in the data cell.
protected renderDataCellContent ( integer $row, mixed $data )
$row integer the row number (zero-based)
$data mixed the data associated with the row

Property Details

$afterToggle public_oe property

a javascript function that will be invoked after the toggle ajax call. The function signature is function(data)
  • success status of the ajax call, true if the ajax call was successful, false if the ajax call failed.
  • data the data returned by the server in case of a successful call or XHR object in case of error.
Note that if success is true it does not mean that the delete was successful, it only means that the ajax call was successful. Example:
 array(
    class'=>'TbToggleColumn',
    'afterToggle'=>'function(success,data){ if (success) alert("Toggled successfuly"); }',
 ),
public $afterToggle

$checkedButtonLabel public_oe property

the label for the toggle button. Defaults to "Check". Note that the label will not be HTML-encoded when rendering.
public $checkedButtonLabel

$checkedIcon public_oe property

the glyph icon toggle button "checked" state. You may set this property to be false to render a text link instead.
public $checkedIcon

$displayText public_oe property

display button with text or only icon with label tooltip
public $displayText

$emptyButtonLabel public_oe property

the label for the NULL value toggle button. Defaults to "Not Set". Note that the label will not be HTML-encoded when rendering.
public $emptyButtonLabel

$emptyIcon public_oe property

the glyph icon toggle button "empty" state (example for null value)
public $emptyIcon

$filter public_oe property

the HTML code representing a filter input (eg a text field, a dropdown list) that is used for this data column. This property is effective only when {@link CGridView::filter} is set. If this property is not set, a text field will be generated as the filter input; If this property is an array, a dropdown list will be generated that uses this property value as the list options. If you don't want a filter for this data column, set this value to false.
Since: 1.1.1
public $filter

$footerHtmlOptions public_oe property

the HTML options for the footer cell tag.
public $footerHtmlOptions

$headerHtmlOptions public_oe property

the HTML options for the header cell tag.
public $headerHtmlOptions

$htmlOptions public_oe property

the HTML options for the data cell tags.
public $htmlOptions

$name public_oe property

the attribute name of the data model. Used for column sorting, filtering and to render the corresponding attribute value in each data cell. If {@link value} is specified it will be used to rendered the data cell instead of the attribute value.
See also: value
See also: sortable
public $name

$sortable public_oe property

whether the column is sortable. If so, the header cell will contain a link that may trigger the sorting. Defaults to true. Note that if {@link name} is not set, or if {@link name} is not allowed by {@link CSort}, this property will be treated as false.
See also: name
public $sortable

$toggleAction public_oe property

Name of the action to call and toggle values
public $toggleAction

$toggleOptions protected_oe property

the configuration for toggle button.
protected $toggleOptions

$uncheckedButtonLabel public_oe property

the label for the toggle button. Defaults to "Uncheck". Note that the label will not be HTML-encoded when rendering.
public $uncheckedButtonLabel

$uncheckedIcon public_oe property

the glyph icon toggle button "unchecked" state. You may set this property to be false to render a text link instead.
public $uncheckedIcon

$uniqueClassSuffix public_oe property

suffix substituted to a name class of the tag
public $uniqueClassSuffix