PHP Class WhRelationalColumn

Displays a clickable column that will make an ajax request and display its resulting data into a new row.
Author: Antonio Ramirez ([email protected])
Inheritance: extends TbDataColumn
Afficher le fichier Open project: 2amigos/yiiwheels

Méthodes publiques

Свойство Type Description
$afterAjaxUpdate a javascript function that will be invoked if an AJAX call occurs. The function signature is function(tr, rowid, data)
  • tr is the newly created TR HTML object that will display the returned server data.
  • rowid the model id of the row.
  • data is the data returned by the server that is already displayed on the row.
Note: This handler is not called for JSONP requests. Example (add in a call to TbRelationalColumn):
 ...
 'afterAjaxUpdate'=>'js:function(tr,rowid, data){ console.log(rowid); }',
 ...
$ajaxErrorMessage string the message that is displayed on the newly created row in case there is an AJAX error.
$cacheData boolean if set to true, there won't be more than one AJAX request. If set to false, the widget will continuously make AJAX requests. This is useful if the data could vary. If the data doesn't change then is better to set it to true. Defaults to true.
$cssClass string the class name that will wrap up the cell content. Important Note: this class will be used as the trigger for the AJAX call, so make sure is unique for the column.
$url string the route to call via AJAX to get the data from

Méthodes publiques

Méthode Description
init ( ) widget initialization
registerClientScript ( ) Register script that will handle its behavior
renderDataCell ( integer $row ) Overrides CDataColumn renderDataCell in order to wrap up its content with the object that will be used as a trigger.

Méthodes protégées

Méthode Description
getPrimaryKey ( CActiveRecord $data ) : null | string Helper function to return the primary key of the $data * IMPORTANT: composite keys on CActiveDataProviders will return the keys joined by comma

Method Details

getPrimaryKey() protected méthode

Helper function to return the primary key of the $data * IMPORTANT: composite keys on CActiveDataProviders will return the keys joined by comma
protected getPrimaryKey ( CActiveRecord $data ) : null | string
$data CActiveRecord
Résultat null | string

init() public méthode

widget initialization
public init ( )

registerClientScript() public méthode

Register script that will handle its behavior

renderDataCell() public méthode

Important: Making use of links as a content for this of column is an error.
public renderDataCell ( integer $row )
$row integer

Property Details

$afterAjaxUpdate public_oe property

a javascript function that will be invoked if an AJAX call occurs. The function signature is function(tr, rowid, data)
  • tr is the newly created TR HTML object that will display the returned server data.
  • rowid the model id of the row.
  • data is the data returned by the server that is already displayed on the row.
Note: This handler is not called for JSONP requests. Example (add in a call to TbRelationalColumn):
 ...
 'afterAjaxUpdate'=>'js:function(tr,rowid, data){ console.log(rowid); }',
 ...
public $afterAjaxUpdate

$ajaxErrorMessage public_oe property

the message that is displayed on the newly created row in case there is an AJAX error.
public string $ajaxErrorMessage
Résultat string

$cacheData public_oe property

if set to true, there won't be more than one AJAX request. If set to false, the widget will continuously make AJAX requests. This is useful if the data could vary. If the data doesn't change then is better to set it to true. Defaults to true.
public bool $cacheData
Résultat boolean

$cssClass public_oe property

the class name that will wrap up the cell content. Important Note: this class will be used as the trigger for the AJAX call, so make sure is unique for the column.
public string $cssClass
Résultat string

$url public_oe property

the route to call via AJAX to get the data from
public string $url
Résultat string