\TbJsonGridView

## Class TbJsonGridView

Converts TbGridView into a Json Javascript grid when using AJAX updates calls. This grid makes use of localStorage or a custom in memory plugin to avoid repetitive ajax requests/responses and speed up data visualization.

Summary

Methods
Properties
Constants
init()
run()
renderPager()
renderItems()
renderSummary()
renderTemplate()
renderTableBody()
renderTableRow()
registerClientScript()
$type
$pagerCssClass
$pager
$cssFile
$responsiveTable
$extraParams
$json
$template
$cacheTTL
$cacheTTLType
$localCache
$dataProvider
TYPE_STRIPED
TYPE_BORDERED
TYPE_CONDENSED
TYPE_HOVER
initColumns()
createDataColumn()
writeResponsiveCss()
renderTemplates()
renderTableBodyJSON()
renderTableRowJSON()
$_showSummary
N/A
No private methods found
No private properties found
N/A

Constants

TYPE_STRIPED

TYPE_STRIPED

TYPE_BORDERED

TYPE_BORDERED

TYPE_CONDENSED

TYPE_CONDENSED

TYPE_HOVER

TYPE_HOVER

Properties

$type

$type : string|array

Type

string|array — the table type. Valid values are 'striped', 'bordered', 'condensed' and/or 'hover'.

$pagerCssClass

$pagerCssClass : string

Type

string — the CSS class name for the pager container. Defaults to 'pagination'.

$pager

$pager : array

Type

array — the configuration for the pager. Defaults to <code>array('class'=>'ext.booster.widgets.TbPager')</code>.

$cssFile

$cssFile : string

Type

string — the URL of the CSS file used by this grid view. Defaults to false, meaning that no CSS will be included.

$responsiveTable

$responsiveTable : bool

Type

bool — whether to make the grid responsive

$extraParams

$extraParams : array

Type

array — of additional parameters to pass to values

$json

$json : boolean

Type

boolean — true when there is an AJAX request. TbJsonGridView expect a JSON response.

$template

$template : string

Type

string — Overridden standard template to add second pager on top.

$cacheTTL

$cacheTTL : int

Type

int — how long we keep the responses on cache? It will depend on cacheTTLType (seconds, minutes, hours)

$cacheTTLType

$cacheTTLType : string

Type

string — the type of cache duration s: seconds m: minutes h: hours

$localCache

$localCache : bool

Type

bool — whether we use client ajax cache or not. True by default.

$dataProvider

$dataProvider : \CActiveDataProvider

the data provider for the view.

Type

\CActiveDataProvider

$_showSummary

$_showSummary : bool

Type

bool — true when there is an AJAX request and having in template summary

Methods

init()

init()

Initializes $json property to find out whether ajax request or not

Initializes the widget.

run()

run()

Renders the view.

This is the main entry of the whole view rendering. Child classes should mainly override {@link renderContent} method.

renderPager()

renderPager()

Renders the pager.

renderItems()

renderItems()

Renders the data items for the grid view.

renderSummary()

renderSummary()

renderTemplate()

renderTemplate(string $id, string $text) : string

Encloses the given JavaScript within a script tag.

Parameters

string $id
string $text

the JavaScript to be enclosed

Returns

string —

the enclosed JavaScript

renderTableBody()

renderTableBody()

Renders the table body.

renderTableRow()

renderTableRow(integer $row)

Renders a table body row.

Parameters

integer $row

the row number (zero-based).

registerClientScript()

registerClientScript()

Registers necessary client scripts.

initColumns()

initColumns()

Creates column objects and initializes them.

Creates column objects and initializes them.

createDataColumn()

createDataColumn(mixed $text) : \TbJSONDataColumn|\TbDataColumn|\CDataColumn

Creates a column based on a shortcut column specification string.

Creates a column based on a shortcut column specification string.

Parameters

mixed $text

the column specification string

Throws

\CException

if the column format is incorrect

Returns

\TbJSONDataColumn|\TbDataColumn|\CDataColumn —

the column instance

writeResponsiveCss()

writeResponsiveCss()

### .writeResponsiveCss()

Writes responsiveCSS

renderTemplates()

renderTemplates()

Renders the required templates for the client engine (jqote2 used)

renderTableBodyJSON()

renderTableBodyJSON(integer $rows) : array

Renders the body table for JSON requests - assumed ajax is for JSON

Parameters

integer $rows

Returns

array

renderTableRowJSON()

renderTableRowJSON(integer $row) : array

Renders a table body row for JSON requests - assumed ajax is for JSON

Parameters

integer $row

Returns

array