PHP Класс TbRelationalColumn

Displays a clickable column that will make an ajax request and display its resulting data into a new row.
Наследование: extends TbDataColumn
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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

Описание методов

getPrimaryKey() защищенный Метод

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
Результат null | string

init() публичный Метод

widget initialization
public init ( )

registerClientScript() публичный Метод

Register script that will handle its behavior

renderDataCell() публичный Метод

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

Описание свойств

$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); }',
 ...
public $afterAjaxUpdate

$ajaxErrorMessage публичное свойство

the message that is displayed on the newly created row in case there is an AJAX error.
public string $ajaxErrorMessage
Результат string

$cacheData публичное свойство

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
Результат boolean

$cssClass публичное свойство

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
Результат string

$url публичное свойство

the route to call via AJAX to get the data from
public string $url
Результат string