\TbRelationalColumn

## TbRelationalColumn class

Displays a clickable column that will make an ajax request and display its resulting data into a new row.

Summary

Methods
Properties
Constants
renderFilterCell()
init()
renderDataCell()
registerClientScript()
$filterInputOptions
$url
$cssClass
$cacheData
$afterAjaxUpdate
$ajaxErrorMessage
$submitData
$grid
No constants found
renderHeaderCellContent()
renderFilterCellContent()
getPrimaryKey()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$filterInputOptions

$filterInputOptions : array

Type

array — HTML options for filter input

$url

$url : string

Type

string — the route to call via AJAX to get the data from

$cssClass

$cssClass : string

Type

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.

$cacheData

$cacheData : bool

Type

bool — 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.

$afterAjaxUpdate

$afterAjaxUpdate : string

Type

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

$ajaxErrorMessage

$ajaxErrorMessage : string

Type

string — the message that is displayed on the newly created row in case there is an AJAX error.

$submitData

$submitData : array

Type

array — allows you to merge extra data into the query string being sent to the server. normally the row id is sent as 'id'

$grid

$grid : \TbGridView|\TbExtendedGridView

the grid view object that owns this column.

Type

\TbGridView|\TbExtendedGridView

Methods

renderFilterCell()

renderFilterCell()

### .renderFilterCell()

Renders the filter cell.

init()

init()

widget initialization

renderDataCell()

renderDataCell(int $row)

Overrides CDataColumn renderDataCell in order to wrap up its content with the object that will be used as a trigger.

Important: Making use of links as a content for this of column is an error.

Parameters

int $row

registerClientScript()

registerClientScript()

Register script that will handle its behavior

renderHeaderCellContent()

renderHeaderCellContent()

### .renderHeaderCellContent()

Renders the header cell content. This method will render a link that can trigger the sorting if the column is sortable.

renderFilterCellContent()

renderFilterCellContent()

### .renderFilterCellContent()

Renders the filter cell content. On top of Yii's default, here we can provide HTML options for actual filter input

getPrimaryKey()

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 two dashes: `--`

Parameters

\CActiveRecord $data

Returns

null|string