PHP Class kartik\grid\GridView

Since: 1.0
Author: Kartik Visweswaran ([email protected])
Inheritance: extends yii\grid\GridView
Show file Open project: kartik-v/yii2-grid Class Usage Examples

Public Properties

Property Type Description
$afterFooter configuration of additional footer table rows that will be rendered after the default grid footer row. If set as a _string_, it will be displayed as is, without any HTML encoding. If set as an _array_, each row in this array corresponds to a HTML table row, where you can configure the columns with these properties: - columns: _array_, the footer row columns configuration where you can set the following properties: - content: _string_, the grid cell content for the column - tag: _string_, the tag for rendering the grid cell. If not set, defaults to th. - options: _array_, the HTML attributes for the grid cell - options: _array_, the HTML attributes for the table row
$afterHeader configuration of additional header table rows that will be rendered after default grid header row. If set as a _string_, it will be displayed as is, without any HTML encoding. If set as an _array_, each row in this array corresponds to a HTML table row, where you can configure the columns with these properties: - columns: _array_, the header row columns configuration where you can set the following properties: - content: _string_, the grid cell content for the column - tag: _string_, the tag for rendering the grid cell. If not set, defaults to th. - options: _array_, the HTML attributes for the grid cell - options: _array_, the HTML attributes for the table row
$autoXlFormat determines whether the exported EXCEL cell data will be automatically guessed and formatted based on [[DataColumn::format]] property. This property is applicable for EXCEL export content only. One can override this behavior and change the auto-derived format mask by setting [[DataColumn::xlFormat]].
$beforeFooter configuration of additional footer table rows that will be rendered before the default grid footer row. If set as a _string_, it will be displayed as is, without any HTML encoding. If set as an _array_, each row in this array corresponds to a HTML table row, where you can configure the columns with these properties: - columns: _array_, the footer row columns configuration where you can set the following properties: - content: _string_, the grid cell content for the column - tag: _string_, the tag for rendering the grid cell. If not set, defaults to th. - options: _array_, the HTML attributes for the grid cell - options: _array_, the HTML attributes for the table row
$beforeHeader configuration of additional header table rows that will be rendered before the default grid header row. If set as a _string_, it will be displayed as is, without any HTML encoding. If set as an _array_, each row in this array corresponds to a HTML table row, where you can configure the columns with these properties: - columns: _array_, the header row columns configuration where you can set the following properties: - content: _string_, the grid cell content for the column - tag: _string_, the tag for rendering the grid cell. If not set, defaults to th. - options: _array_, the HTML attributes for the grid cell - options: _array_, the HTML attributes for the table row
$bootstrap whether the grid view will have Bootstrap table styling.
$bordered whether the grid will have a bordered style. Applicable only if bootstrap is true.
$captionOptions the HTML attributes for the grid caption
$condensed whether the grid will have a condensed style. Applicable only if bootstrap is true.
$containerOptions the HTML attributes for the grid container. The grid items will be wrapped in a div container with the configured HTML attributes. The ID for the container will be auto generated.
$dataColumnClass the default data column class if the class name is not explicitly specified when configuring a data column. Defaults to 'kartik\grid\DataColumn'.
$defaultPagination the default pagination that will be read by toggle data. Should be one of 'page' or 'all'. If not set to 'all', it will always defaults to 'page'.
$export the grid export menu settings. Displays a Bootstrap dropdown menu that allows you to export the grid as either html, csv, or excel. If set to false, will not be displayed. The following options can be set: - icon: _string_,the glyphicon suffix to be displayed before the export menu label. If not set or is an empty string, this will not be displayed. Defaults to export if fontAwesome is false and share-square-o if fontAwesome is true. - label: _string_,the export menu label (this is not HTML encoded). Defaults to ''. - showConfirmAlert: bool, whether to show a confirmation alert dialog before download. This confirmation dialog will notify user about the type of exported file for download and to disable popup blockers. Defaults to true. - target: _string_, the target for submitting the export form, which will trigger the download of the exported file. Must be one of the TARGET_ constants. Defaults to GridView::TARGET_POPUP. - messages: _array_, the configuration of various messages that will be displayed at runtime: - allowPopups: _string_, the message to be shown to disable browser popups for download. Defaults to Disable any popup blockers in your browser to ensure proper download.. - confirmDownload: _string_, the message to be shown for confirming to proceed with the download. Defaults to Ok to proceed?. - downloadProgress: _string_, the message to be shown in a popup dialog when download request is triggered. Defaults to Generating file. Please wait.... - downloadComplete: _string_, the message to be shown in a popup dialog when download request is completed. Defaults to All done! Click anywhere here to close this window, once you have downloaded the file.. - header: _string_, the header for the page data export dropdown. If set to empty string will not be displayed. Defaults to: . - fontAwesome: bool, whether to use font awesome file type icons. Defaults to false. If you set it to true, then font awesome icons css class will be applied instead of glyphicons. - itemsBefore: _array_, any additional items that will be merged/prepended before with the export dropdown list. This should be similar to the items property as supported by \yii\bootstrap\ButtonDropdown widget. Note the page export items will be automatically generated based on settings in the exportConfig property. - itemsAfter: _array_, any additional items that will be merged/appended after with the export dropdown list. This should be similar to the items property as supported by \yii\bootstrap\ButtonDropdown widget. Note the page export items will be automatically generated based on settings in the exportConfig property. - options: _array_, HTML attributes for the export menu button. Defaults to ['class' => 'btn btn-default', 'title'=>'Export']. - encoding: _string_, the export output file encoding. If not set, defaults to utf-8. - bom: boolean, whether a BOM is to be embedded for text or CSV files with utf-8 encoding. Defaults to true. - menuOptions: _array_, HTML attributes for the export dropdown menu. Defaults to ['class' => 'dropdown-menu dropdown-menu-right']. This property is to be setup exactly as the options property required by the Dropdown widget.
$exportConfig the configuration for each export format. The array keys must be the one of the format constants (CSV, HTML, TEXT, EXCEL, PDF, JSON) and the array value is a configuration array consisiting of these settings: - label: _string_,the label for the export format menu item displayed - icon: _string_,the glyphicon or font-awesome name suffix to be displayed before the export menu item label. If set to an empty string, this will not be displayed. Refer defaultConfig in initExport method for default settings. - showHeader: boolean, whether to show table header row in the output. Defaults to true. - showPageSummary: boolean, whether to show table page summary row in the output. Defaults to true. - showFooter: boolean, whether to show table footer row in the output. Defaults to true. - showCaption: boolean, whether to show table caption in the output (only for HTML). Defaults to true. - filename: the base file name for the generated file. Defaults to 'grid-export'. This will be used to generate a default file name for downloading (extension will be one of csv, html, or xls - based on the format setting). - alertMsg: _string_, the message prompt to show before saving. If this is empty or not set it will not be displayed. - options: _array_, HTML attributes for the export format menu item. - mime: _string_, the mime type (for the file format) to be set before downloading. - config: _array_, the special configuration settings specific to each file format/type. The following configuration options are read specific to each file type: - HTML: The following properties can be set as array key-value pairs: - cssFile: _string_, the css file that will be used in the exported HTML file. Defaults to: https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css. - CSV and TEXT: The following properties can be set as array key-value pairs: - colDelimiter: _string_, the column delimiter string for TEXT and CSV downloads. - rowDelimiter: _string_, the row delimiter string for TEXT and CSV downloads. - EXCEL: The following properties can be set as array key-value pairs: - worksheet: _string_, the name of the worksheet, when saved as EXCEL file. - PDF: Supports all configuration properties as required in Pdf extension. In addition, the following additional special options are recognized: - contentBefore: _string_, any HTML formatted content that will be embedded in the PDF output before the grid. - contentAfter: _string_, any HTML formatted content that will be embedded in the PDF output after the grid. - JSON: The following properties can be set as array key-value pairs: - colHeads: _array_, the column heading names to be output in the json file. If not set, it will be autogenerated as "col-{i}", where {i} is the column index. If slugColHeads is set to true, the extension will attempt to autogenerate column heads based on table column heading, whereever possible. - slugColHeads: boolean, whether to auto-generate column identifiers as slugs based on the table column heading name. If the table column heading contains characters which cannot be slugified, then the extension will autogenerate the column name as "col-{i}". - jsonReplacer: array|JsExpression, the JSON replacer property - can be an array or a JS function created using JsExpression. Refer the JSON documentation for details on setting this property. - indentSpace: int, pretty print json output and indent by number of spaces specified. Defaults to 4.
$exportContainer the HTML attributes for the export button group container. By default this will always have the class = btn-group automatically added, if no class is set.
$exportConversions conversion of defined patterns in the grid cells as a preprocessing before the gridview is formatted for export. Each array row must consist of the following two keys: - from: _string_, is the pattern to search for in each grid column's cells - to: _string_, is the string to replace the pattern in the grid column cells This defaults to: php [ ['from'=>GridView::ICON_ACTIVE, 'to'=>Yii::t('kvgrid', 'Active')], ['from'=>GridView::ICON_INACTIVE, 'to'=>Yii::t('kvgrid', 'Inactive')] ]
$floatHeader whether the grid will have a floating table header.
$floatHeaderOptions the plugin options for the floatThead plugin that would render the floating/sticky table header behavior. The default offset from the top of the window where the floating header will 'stick' when scrolling down is set to 50 assuming a fixed bootstrap navbar on top. You can set this to 0 or any javascript function / expression.
$floatOverflowContainer whether the table header will float and sticks around as you scroll within a container. If responsive is true then this is auto set to true.
$footerRowOptions the HTML attributes for the grid footer row
$hideResizeMobile whether to hide resizable columns for smaller screen sizes (< 768px). Defaults to true.
$hover whether the grid will highlight row on hover. Applicable only if bootstrap is true.
$krajeeDialogSettings configuration settings for the Krajee dialog widget that will be used to render alerts and confirmation dialog prompts
$layout the layout that determines how different sections of the list view should be organized. The layout template will be automatically set based on the [[panel]] setting. If [[panel]] is a valid array, then the [[layout]] will default to the [[panelTemplate]] property. If the [[panel]] property is set to false, then the [[layout]] will default to {summary}\n{items}\n{pager}. The following tokens will be replaced with the corresponding section contents: - {summary}: the summary section. See [[renderSummary()]]. - {errors}: the filter model error summary. See [[renderErrors()]]. - {items}: the list items. See [[renderItems()]]. - {sorter}: the sorter. See [[renderSorter()]]. - {pager}: the pager. See [[renderPager()]]. - {export}: the grid export button menu. See GridView::renderExport. - {toolbar}: the grid panel toolbar. See GridView::renderToolbar. In addition to the above tokens, refer the [[panelTemplate]] property for other tokens supported as part of the bootstrap styled panel.
$pageSummaryContainer
$pageSummaryRowOptions
$panel the panel settings for displaying the grid view within a bootstrap styled panel. This property is therefore applicable only if [[bootstrap]] property is true. The following array keys can be configured: - type: _string_, the panel contextual type. Set it to one of the TYPE constants. If not set, will default to [[TYPE_DEFAULT]]. - heading: string|boolean, the panel heading. If set to false, will not be displayed. - headingOptions: _array_, HTML attributes for the panel heading container. Defaults to ['class'=>'panel-heading']. - footer: string|boolean, the panel footer. If set to false will not be displayed. - footerOptions: _array_, HTML attributes for the panel footer container. Defaults to ['class'=>'panel-footer']. - 'before': string|boolean, content to be placed before/above the grid (after the header). To not display this section, set this to false. - beforeOptions: _array_, HTML attributes for the before text. If the class is not set, it will default to kv-panel-before. - 'after': string|boolean, any content to be placed after/below the grid (before the footer). To not display this section, set this to false. - afterOptions: _array_, HTML attributes for the after text. If the class is not set, it will default to kv-panel-after.
$panelAfterTemplate the template for rendering the {after} part in the layout templates. The following special variables are recognized and will be replaced: - {after}: _string_, which will render the after text passed within the [[panel]] settings - {summary}: _string_, which will render the grid results summary. - {items}: _string_, which will render the grid items. - {sort}: _string_, which will render the grid sort links. - {pager}: _string_, which will render the grid pagination links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}`: _string_, which will render the [[export]] menu button content
$panelBeforeTemplate the template for rendering the {before} part in the layout templates. The following special tokens are recognized and will be replaced: - {before}: _string_, which will render the [[before]] text passed in the panel settings - {summary}: _string_, which will render the grid results summary. - {items}: _string_, which will render the grid items. - {sort}: _string_, which will render the grid sort links. - {pager}: _string_, which will render the grid pagination links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}`: _string_, which will render the [[export]] menu button content
$panelFooterTemplate the template for rendering the panel footer. The following special tokens are recognized and will be replaced: - {footer}: _string_, which will render the panel footer content. - {summary}: _string_, which will render the grid results summary. - {items}: _string_, which will render the grid items. - {sort}: _string_, which will render the grid sort links. - {pager}: _string_, which will render the grid pagination links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}: _string_, which will render the [[export]] menu button content
$panelHeadingTemplate the template for rendering the panel heading. The following special tokens are recognized and will be replaced: - {heading}: _string_, which will render the panel heading content. - {summary}: _string_, which will render the grid results summary. - {items}: _string_, which will render the grid items. - {pager}: _string_, which will render the grid pagination links. - {sort}: _string_, which will render the grid sort links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}: _string_, which will render the [[export]] menu button content.
$panelPrefix the panel CSS prefix that will be applied to the panel container for rendering the grid within a bootstrap styled panel. This can be set to a different value to generate different styles for other bootstrap themes. For example, this can be set to box box- for rendering boxes in AdminLTE theme.
$panelTemplate the template for rendering the grid within a bootstrap styled panel. The following special tokens are recognized and will be replaced: - {prefix}: _string_, the CSS prefix name as set in [[panelPrefix]]. Defaults to panel panel-. - {type}: _string_, the panel type that will append the bootstrap contextual CSS. - {panelHeading}: _string_, which will render the panel heading block. - {panelBefore}: _string_, which will render the panel before block. - {panelAfter}: _string_, which will render the panel after block. - {panelFooter}: _string_, which will render the panel footer block. - {items}: _string_, which will render the grid items. - {summary}: _string_, which will render the grid results summary. - {pager}: _string_, which will render the grid pagination links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}: _string_, which will render the [[export]] menu button content.
$perfectScrollbar whether pretty perfect scrollbars using perfect scrollbar plugin is to be used. Defaults to false. If this is set to true, the floatOverflowContainer property will be auto set to true, if floatHeader is true.
$perfectScrollbarOptions the plugin options for the perfect scrollbar plugin.
$persistResize whether to store resized column state using local storage persistence (supported by most modern browsers).
$pjax whether the grid view will be rendered within a pjax container. Defaults to false. If set to true, the entire GridView widget will be parsed via Pjax and auto-rendered inside a yii\widgets\Pjax widget container. If set to false pjax will be disabled and none of the pjax settings will be applied.
$pjaxSettings the pjax settings for the widget. This will be considered only when [[pjax]] is set to true. The following settings are recognized: - neverTimeout: boolean, whether the pjax request should never timeout. Defaults to true. The pjax:timeout event will be configured to disable timing out of pjax requests for the pjax container. - options: _array_, the options for the Pjax widget. - loadingCssClass: boolean/string, the CSS class to be applied to the grid when loading via pjax. If set to false - no css class will be applied. If it is empty, null, or set to true, will default to kv-grid-loading. - beforeGrid: _string_, any content to be embedded within pjax container before the Grid widget. - afterGrid: _string_, any content to be embedded within pjax container after the Grid widget.
$replaceTags tags to replace in the rendered layout. Enter this as $key => $value pairs, where: - $key: _string_, defines the flag. - $value: _string_|_Closure_, the value that will be replaced. You can set it as a callback function to return a string of the signature: function ($widget) { return 'custom'; }. For example, a custom tag like {star} can be set as: php [ '{star}' => '' ]
$resizableColumns whether to allow resizing of columns
$resizableColumnsOptions the resizableColumns plugin options
$resizeStorageKey resizable unique storage prefix to append to the grid id. If empty or not set it will default to Yii::$app->user->id.
$responsive whether the grid will have a responsive style. Applicable only if bootstrap is true.
$responsiveWrap whether the grid will automatically wrap to fit columns for smaller display sizes.
$showPageSummary whether to show the page summary row for the table. This will be displayed above the footer.
$striped whether the grid will have a striped style. Applicable only if bootstrap is true.
$tableOptions the HTML attributes for the grid element
$toggleData whether to enable toggling of grid data. Defaults to true.
$toggleDataContainer the HTML attributes for the toggle data button group container. By default this will always have the class = btn-group automatically added, if no class is set.
$toggleDataOptions the settings for the toggle data button for the toggle data type. This will be setup as an associative array of $key => $value pairs, where $key can be: - maxCount: int|boolean, the maximum number of records uptil which the toggle button will be rendered. If the dataProvider records exceed this setting, the toggleButton will not be displayed. Defaults to 10000 if not set. If you set this to true, the toggle button will always be displayed. If you set this to false the toggle button will not be displayed (similar to toggleData setting). - minCount: int|boolean, the minimum number of records beyond which a confirmation message will be displayed when toggling all records. If the dataProvider record count exceeds this setting, a confirmation message will be alerted to the user. Defaults to 500 if not set. If you set this to true, the confirmation message will always be displayed. If set to false no confirmation message will be displayed. - confirmMsg: _string_, the confirmation message for the toggle data when minCount threshold is exceeded. Defaults to 'There are {totalCount} records. Are you sure you want to display them all?'. - all: _array_, configuration for showing all grid data and the value is the HTML attributes for the button. (refer page for understanding the default options). - page: _array_, configuration for showing first page data and $options is the HTML attributes for the button. The following special options are recognized: - icon: _string_, the glyphicon suffix name. If not set or empty will not be displayed. - label: _string_, the label for the button. This defaults to the following setting: php [ 'maxCount' => 10000, 'minCount' => 1000 'confirmMsg' => Yii::t( 'kvgrid', 'There are {totalCount} records. Are you sure you want to display them all?', ['totalCount' => number_format($this->dataProvider->getTotalCount())] ), 'all' => [ 'icon' => 'resize-full', 'label' => 'All', 'class' => 'btn btn-default', 'title' => 'Show all data' ], 'page' => [ 'icon' => 'resize-small', 'label' => 'Page', 'class' => 'btn btn-default', 'title' => 'Show first page data' ], ] ```
$toolbar the toolbar content configuration. Can be setup as a string or an array. When set as a _string_, it will be rendered as is. When set as an _array_, each line item will be considered as per the following rules: - if the line item is setup as a _string_, it will be rendered as is - if the line item is an _array_, the following keys can be setup to control the rendering of the toolbar: - content: _string_, the content to be rendered as a bootstrap button group. The following special tags in the content are recognized and will be replaced: - {export}, _string_ which will render the [[export]] menu button content. - {toggleData}, _string_ which will render the button to toggle between page data and all data. - options: _array_, the HTML attributes for the button group div container. By default the CSS class btn-group will be attached to this container if no class is set.

Protected Properties

Property Type Description
$_gridClientFunc the generated client script for the grid
$_isShowAll whether the current mode is showing all data
$_module the grid module.
$_toggleButtonId HTML attribute identifier for the toggle button
$_toggleDataKey key to identify showing all data
$_toggleOptionsVar the JS variable to store the toggle options
$_toggleScript generated plugin script for the toggle button

Public Methods

Method Description
init ( )
renderColumnGroup ( )
renderExport ( ) : string Renders the export menu.
renderPageSummary ( ) : string Renders the table page summary.
renderTableBody ( )
renderTableFooter ( )
renderTableHeader ( )
renderToggleData ( ) : string Renders the toggle data button.
run ( )

Protected Methods

Method Description
beginPjax ( ) Begins the markup for the [[Pjax]] container.
endPjax ( ) Ends the markup for the [[Pjax]] container.
genToggleDataScript ( ) Generate toggle data client validation script.
generateRows ( array | string $data ) : string Generate HTML markup for additional table rows for header and/or footer.
initBootstrapStyle ( ) Initialize bootstrap specific styling.
initCss ( array &$options, string $css ) Sets a default css class within options if not set
initExport ( ) Initialize grid export.
initHeader ( ) Initialize table header.
initLayout ( ) Initialize the grid layout.
initToggleData ( ) Initialize toggle data button options.
parseExportConfig ( array $exportConfig, array $defaultExportConfig ) : array Parses export configuration and returns the merged defaults.
registerAssets ( ) Registers client assets for the GridView widget.
renderPanel ( ) Sets the grid panel layout based on the [[template]] and [[panel]] settings.
renderToolbar ( ) : string Generates the toolbar.

Method Details

beginPjax() protected method

Begins the markup for the [[Pjax]] container.
protected beginPjax ( )

endPjax() protected method

Ends the markup for the [[Pjax]] container.
protected endPjax ( )

genToggleDataScript() protected method

Generate toggle data client validation script.
protected genToggleDataScript ( )

generateRows() protected method

Generate HTML markup for additional table rows for header and/or footer.
protected generateRows ( array | string $data ) : string
$data array | string the table rows configuration
return string

init() public method

public init ( )

initBootstrapStyle() protected method

Initialize bootstrap specific styling.
protected initBootstrapStyle ( )

initCss() protected static method

Sets a default css class within options if not set
protected static initCss ( array &$options, string $css )
$options array the HTML options
$css string the CSS class to test and append

initExport() protected method

Initialize grid export.
protected initExport ( )

initHeader() protected method

Initialize table header.
protected initHeader ( )

initLayout() protected method

Initialize the grid layout.
protected initLayout ( )

initToggleData() protected method

Initialize toggle data button options.
protected initToggleData ( )

parseExportConfig() protected static method

Parses export configuration and returns the merged defaults.
protected static parseExportConfig ( array $exportConfig, array $defaultExportConfig ) : array
$exportConfig array the export configuration
$defaultExportConfig array the default export configuration
return array

registerAssets() protected method

Registers client assets for the GridView widget.
protected registerAssets ( )

renderColumnGroup() public method

public renderColumnGroup ( )

renderExport() public method

Renders the export menu.
public renderExport ( ) : string
return string

renderPageSummary() public method

Renders the table page summary.
public renderPageSummary ( ) : string
return string the rendering result.

renderPanel() protected method

Sets the grid panel layout based on the [[template]] and [[panel]] settings.
protected renderPanel ( )

renderTableBody() public method

public renderTableBody ( )

renderTableFooter() public method

public renderTableFooter ( )

renderTableHeader() public method

public renderTableHeader ( )

renderToggleData() public method

Renders the toggle data button.
public renderToggleData ( ) : string
return string

renderToolbar() protected method

Generates the toolbar.
protected renderToolbar ( ) : string
return string

run() public method

public run ( )

Property Details

$_gridClientFunc protected property

the generated client script for the grid
protected $_gridClientFunc

$_isShowAll protected property

whether the current mode is showing all data
protected $_isShowAll

$_module protected property

the grid module.
protected $_module

$_toggleButtonId protected property

HTML attribute identifier for the toggle button
protected $_toggleButtonId

$_toggleDataKey protected property

key to identify showing all data
protected $_toggleDataKey

$_toggleOptionsVar protected property

the JS variable to store the toggle options
protected $_toggleOptionsVar

$_toggleScript protected property

generated plugin script for the toggle button
protected $_toggleScript

$afterFooter public property

configuration of additional footer table rows that will be rendered after the default grid footer row. If set as a _string_, it will be displayed as is, without any HTML encoding. If set as an _array_, each row in this array corresponds to a HTML table row, where you can configure the columns with these properties: - columns: _array_, the footer row columns configuration where you can set the following properties: - content: _string_, the grid cell content for the column - tag: _string_, the tag for rendering the grid cell. If not set, defaults to th. - options: _array_, the HTML attributes for the grid cell - options: _array_, the HTML attributes for the table row
public $afterFooter

$afterHeader public property

configuration of additional header table rows that will be rendered after default grid header row. If set as a _string_, it will be displayed as is, without any HTML encoding. If set as an _array_, each row in this array corresponds to a HTML table row, where you can configure the columns with these properties: - columns: _array_, the header row columns configuration where you can set the following properties: - content: _string_, the grid cell content for the column - tag: _string_, the tag for rendering the grid cell. If not set, defaults to th. - options: _array_, the HTML attributes for the grid cell - options: _array_, the HTML attributes for the table row
public $afterHeader

$autoXlFormat public property

determines whether the exported EXCEL cell data will be automatically guessed and formatted based on [[DataColumn::format]] property. This property is applicable for EXCEL export content only. One can override this behavior and change the auto-derived format mask by setting [[DataColumn::xlFormat]].
public $autoXlFormat

$beforeFooter public property

configuration of additional footer table rows that will be rendered before the default grid footer row. If set as a _string_, it will be displayed as is, without any HTML encoding. If set as an _array_, each row in this array corresponds to a HTML table row, where you can configure the columns with these properties: - columns: _array_, the footer row columns configuration where you can set the following properties: - content: _string_, the grid cell content for the column - tag: _string_, the tag for rendering the grid cell. If not set, defaults to th. - options: _array_, the HTML attributes for the grid cell - options: _array_, the HTML attributes for the table row
public $beforeFooter

$beforeHeader public property

configuration of additional header table rows that will be rendered before the default grid header row. If set as a _string_, it will be displayed as is, without any HTML encoding. If set as an _array_, each row in this array corresponds to a HTML table row, where you can configure the columns with these properties: - columns: _array_, the header row columns configuration where you can set the following properties: - content: _string_, the grid cell content for the column - tag: _string_, the tag for rendering the grid cell. If not set, defaults to th. - options: _array_, the HTML attributes for the grid cell - options: _array_, the HTML attributes for the table row
public $beforeHeader

$bootstrap public property

whether the grid view will have Bootstrap table styling.
public $bootstrap

$bordered public property

whether the grid will have a bordered style. Applicable only if bootstrap is true.
public $bordered

$captionOptions public property

the HTML attributes for the grid caption
public $captionOptions

$condensed public property

whether the grid will have a condensed style. Applicable only if bootstrap is true.
public $condensed

$containerOptions public property

the HTML attributes for the grid container. The grid items will be wrapped in a div container with the configured HTML attributes. The ID for the container will be auto generated.
public $containerOptions

$dataColumnClass public property

the default data column class if the class name is not explicitly specified when configuring a data column. Defaults to 'kartik\grid\DataColumn'.
public $dataColumnClass

$defaultPagination public property

the default pagination that will be read by toggle data. Should be one of 'page' or 'all'. If not set to 'all', it will always defaults to 'page'.
public $defaultPagination

$export public property

the grid export menu settings. Displays a Bootstrap dropdown menu that allows you to export the grid as either html, csv, or excel. If set to false, will not be displayed. The following options can be set: - icon: _string_,the glyphicon suffix to be displayed before the export menu label. If not set or is an empty string, this will not be displayed. Defaults to export if fontAwesome is false and share-square-o if fontAwesome is true. - label: _string_,the export menu label (this is not HTML encoded). Defaults to ''. - showConfirmAlert: bool, whether to show a confirmation alert dialog before download. This confirmation dialog will notify user about the type of exported file for download and to disable popup blockers. Defaults to true. - target: _string_, the target for submitting the export form, which will trigger the download of the exported file. Must be one of the TARGET_ constants. Defaults to GridView::TARGET_POPUP. - messages: _array_, the configuration of various messages that will be displayed at runtime: - allowPopups: _string_, the message to be shown to disable browser popups for download. Defaults to Disable any popup blockers in your browser to ensure proper download.. - confirmDownload: _string_, the message to be shown for confirming to proceed with the download. Defaults to Ok to proceed?. - downloadProgress: _string_, the message to be shown in a popup dialog when download request is triggered. Defaults to Generating file. Please wait.... - downloadComplete: _string_, the message to be shown in a popup dialog when download request is completed. Defaults to All done! Click anywhere here to close this window, once you have downloaded the file.. - header: _string_, the header for the page data export dropdown. If set to empty string will not be displayed. Defaults to: . - fontAwesome: bool, whether to use font awesome file type icons. Defaults to false. If you set it to true, then font awesome icons css class will be applied instead of glyphicons. - itemsBefore: _array_, any additional items that will be merged/prepended before with the export dropdown list. This should be similar to the items property as supported by \yii\bootstrap\ButtonDropdown widget. Note the page export items will be automatically generated based on settings in the exportConfig property. - itemsAfter: _array_, any additional items that will be merged/appended after with the export dropdown list. This should be similar to the items property as supported by \yii\bootstrap\ButtonDropdown widget. Note the page export items will be automatically generated based on settings in the exportConfig property. - options: _array_, HTML attributes for the export menu button. Defaults to ['class' => 'btn btn-default', 'title'=>'Export']. - encoding: _string_, the export output file encoding. If not set, defaults to utf-8. - bom: boolean, whether a BOM is to be embedded for text or CSV files with utf-8 encoding. Defaults to true. - menuOptions: _array_, HTML attributes for the export dropdown menu. Defaults to ['class' => 'dropdown-menu dropdown-menu-right']. This property is to be setup exactly as the options property required by the Dropdown widget.
public $export

$exportConfig public property

the configuration for each export format. The array keys must be the one of the format constants (CSV, HTML, TEXT, EXCEL, PDF, JSON) and the array value is a configuration array consisiting of these settings: - label: _string_,the label for the export format menu item displayed - icon: _string_,the glyphicon or font-awesome name suffix to be displayed before the export menu item label. If set to an empty string, this will not be displayed. Refer defaultConfig in initExport method for default settings. - showHeader: boolean, whether to show table header row in the output. Defaults to true. - showPageSummary: boolean, whether to show table page summary row in the output. Defaults to true. - showFooter: boolean, whether to show table footer row in the output. Defaults to true. - showCaption: boolean, whether to show table caption in the output (only for HTML). Defaults to true. - filename: the base file name for the generated file. Defaults to 'grid-export'. This will be used to generate a default file name for downloading (extension will be one of csv, html, or xls - based on the format setting). - alertMsg: _string_, the message prompt to show before saving. If this is empty or not set it will not be displayed. - options: _array_, HTML attributes for the export format menu item. - mime: _string_, the mime type (for the file format) to be set before downloading. - config: _array_, the special configuration settings specific to each file format/type. The following configuration options are read specific to each file type: - HTML: The following properties can be set as array key-value pairs: - cssFile: _string_, the css file that will be used in the exported HTML file. Defaults to: https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css. - CSV and TEXT: The following properties can be set as array key-value pairs: - colDelimiter: _string_, the column delimiter string for TEXT and CSV downloads. - rowDelimiter: _string_, the row delimiter string for TEXT and CSV downloads. - EXCEL: The following properties can be set as array key-value pairs: - worksheet: _string_, the name of the worksheet, when saved as EXCEL file. - PDF: Supports all configuration properties as required in Pdf extension. In addition, the following additional special options are recognized: - contentBefore: _string_, any HTML formatted content that will be embedded in the PDF output before the grid. - contentAfter: _string_, any HTML formatted content that will be embedded in the PDF output after the grid. - JSON: The following properties can be set as array key-value pairs: - colHeads: _array_, the column heading names to be output in the json file. If not set, it will be autogenerated as "col-{i}", where {i} is the column index. If slugColHeads is set to true, the extension will attempt to autogenerate column heads based on table column heading, whereever possible. - slugColHeads: boolean, whether to auto-generate column identifiers as slugs based on the table column heading name. If the table column heading contains characters which cannot be slugified, then the extension will autogenerate the column name as "col-{i}". - jsonReplacer: array|JsExpression, the JSON replacer property - can be an array or a JS function created using JsExpression. Refer the JSON documentation for details on setting this property. - indentSpace: int, pretty print json output and indent by number of spaces specified. Defaults to 4.
public $exportConfig

$exportContainer public property

the HTML attributes for the export button group container. By default this will always have the class = btn-group automatically added, if no class is set.
public $exportContainer

$exportConversions public property

conversion of defined patterns in the grid cells as a preprocessing before the gridview is formatted for export. Each array row must consist of the following two keys: - from: _string_, is the pattern to search for in each grid column's cells - to: _string_, is the string to replace the pattern in the grid column cells This defaults to: php [ ['from'=>GridView::ICON_ACTIVE, 'to'=>Yii::t('kvgrid', 'Active')], ['from'=>GridView::ICON_INACTIVE, 'to'=>Yii::t('kvgrid', 'Inactive')] ]
public $exportConversions

$floatHeader public property

whether the grid will have a floating table header.
public $floatHeader

$floatHeaderOptions public property

the plugin options for the floatThead plugin that would render the floating/sticky table header behavior. The default offset from the top of the window where the floating header will 'stick' when scrolling down is set to 50 assuming a fixed bootstrap navbar on top. You can set this to 0 or any javascript function / expression.
See also: http://mkoryak.github.io/floatThead#options
public $floatHeaderOptions

$floatOverflowContainer public property

whether the table header will float and sticks around as you scroll within a container. If responsive is true then this is auto set to true.
public $floatOverflowContainer

$footerRowOptions public property

the HTML attributes for the grid footer row
public $footerRowOptions

$hideResizeMobile public property

whether to hide resizable columns for smaller screen sizes (< 768px). Defaults to true.
public $hideResizeMobile

$hover public property

whether the grid will highlight row on hover. Applicable only if bootstrap is true.
public $hover

$krajeeDialogSettings public property

configuration settings for the Krajee dialog widget that will be used to render alerts and confirmation dialog prompts
See also: http://demos.krajee.com/dialog
public $krajeeDialogSettings

$layout public property

the layout that determines how different sections of the list view should be organized. The layout template will be automatically set based on the [[panel]] setting. If [[panel]] is a valid array, then the [[layout]] will default to the [[panelTemplate]] property. If the [[panel]] property is set to false, then the [[layout]] will default to {summary}\n{items}\n{pager}. The following tokens will be replaced with the corresponding section contents: - {summary}: the summary section. See [[renderSummary()]]. - {errors}: the filter model error summary. See [[renderErrors()]]. - {items}: the list items. See [[renderItems()]]. - {sorter}: the sorter. See [[renderSorter()]]. - {pager}: the pager. See [[renderPager()]]. - {export}: the grid export button menu. See GridView::renderExport. - {toolbar}: the grid panel toolbar. See GridView::renderToolbar. In addition to the above tokens, refer the [[panelTemplate]] property for other tokens supported as part of the bootstrap styled panel.
public $layout

$pageSummaryContainer public property

public $pageSummaryContainer

$pageSummaryRowOptions public property

public $pageSummaryRowOptions

$panel public property

the panel settings for displaying the grid view within a bootstrap styled panel. This property is therefore applicable only if [[bootstrap]] property is true. The following array keys can be configured: - type: _string_, the panel contextual type. Set it to one of the TYPE constants. If not set, will default to [[TYPE_DEFAULT]]. - heading: string|boolean, the panel heading. If set to false, will not be displayed. - headingOptions: _array_, HTML attributes for the panel heading container. Defaults to ['class'=>'panel-heading']. - footer: string|boolean, the panel footer. If set to false will not be displayed. - footerOptions: _array_, HTML attributes for the panel footer container. Defaults to ['class'=>'panel-footer']. - 'before': string|boolean, content to be placed before/above the grid (after the header). To not display this section, set this to false. - beforeOptions: _array_, HTML attributes for the before text. If the class is not set, it will default to kv-panel-before. - 'after': string|boolean, any content to be placed after/below the grid (before the footer). To not display this section, set this to false. - afterOptions: _array_, HTML attributes for the after text. If the class is not set, it will default to kv-panel-after.
public $panel

$panelAfterTemplate public property

the template for rendering the {after} part in the layout templates. The following special variables are recognized and will be replaced: - {after}: _string_, which will render the after text passed within the [[panel]] settings - {summary}: _string_, which will render the grid results summary. - {items}: _string_, which will render the grid items. - {sort}: _string_, which will render the grid sort links. - {pager}: _string_, which will render the grid pagination links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}`: _string_, which will render the [[export]] menu button content
public $panelAfterTemplate

$panelBeforeTemplate public property

the template for rendering the {before} part in the layout templates. The following special tokens are recognized and will be replaced: - {before}: _string_, which will render the [[before]] text passed in the panel settings - {summary}: _string_, which will render the grid results summary. - {items}: _string_, which will render the grid items. - {sort}: _string_, which will render the grid sort links. - {pager}: _string_, which will render the grid pagination links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}`: _string_, which will render the [[export]] menu button content
public $panelBeforeTemplate

$panelFooterTemplate public property

the template for rendering the panel footer. The following special tokens are recognized and will be replaced: - {footer}: _string_, which will render the panel footer content. - {summary}: _string_, which will render the grid results summary. - {items}: _string_, which will render the grid items. - {sort}: _string_, which will render the grid sort links. - {pager}: _string_, which will render the grid pagination links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}: _string_, which will render the [[export]] menu button content
public $panelFooterTemplate

$panelHeadingTemplate public property

the template for rendering the panel heading. The following special tokens are recognized and will be replaced: - {heading}: _string_, which will render the panel heading content. - {summary}: _string_, which will render the grid results summary. - {items}: _string_, which will render the grid items. - {pager}: _string_, which will render the grid pagination links. - {sort}: _string_, which will render the grid sort links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}: _string_, which will render the [[export]] menu button content.
public $panelHeadingTemplate

$panelPrefix public property

the panel CSS prefix that will be applied to the panel container for rendering the grid within a bootstrap styled panel. This can be set to a different value to generate different styles for other bootstrap themes. For example, this can be set to box box- for rendering boxes in AdminLTE theme.
public $panelPrefix

$panelTemplate public property

the template for rendering the grid within a bootstrap styled panel. The following special tokens are recognized and will be replaced: - {prefix}: _string_, the CSS prefix name as set in [[panelPrefix]]. Defaults to panel panel-. - {type}: _string_, the panel type that will append the bootstrap contextual CSS. - {panelHeading}: _string_, which will render the panel heading block. - {panelBefore}: _string_, which will render the panel before block. - {panelAfter}: _string_, which will render the panel after block. - {panelFooter}: _string_, which will render the panel footer block. - {items}: _string_, which will render the grid items. - {summary}: _string_, which will render the grid results summary. - {pager}: _string_, which will render the grid pagination links. - {toolbar}: _string_, which will render the [[toolbar]] property passed - {export}: _string_, which will render the [[export]] menu button content.
public $panelTemplate

$perfectScrollbar public property

whether pretty perfect scrollbars using perfect scrollbar plugin is to be used. Defaults to false. If this is set to true, the floatOverflowContainer property will be auto set to true, if floatHeader is true.
See also: https://github.com/noraesae/perfect-scrollbar
public $perfectScrollbar

$perfectScrollbarOptions public property

the plugin options for the perfect scrollbar plugin.
See also: https://github.com/noraesae/perfect-scrollbar
public $perfectScrollbarOptions

$persistResize public property

whether to store resized column state using local storage persistence (supported by most modern browsers).
public $persistResize

$pjax public property

whether the grid view will be rendered within a pjax container. Defaults to false. If set to true, the entire GridView widget will be parsed via Pjax and auto-rendered inside a yii\widgets\Pjax widget container. If set to false pjax will be disabled and none of the pjax settings will be applied.
public $pjax

$pjaxSettings public property

the pjax settings for the widget. This will be considered only when [[pjax]] is set to true. The following settings are recognized: - neverTimeout: boolean, whether the pjax request should never timeout. Defaults to true. The pjax:timeout event will be configured to disable timing out of pjax requests for the pjax container. - options: _array_, the options for the Pjax widget. - loadingCssClass: boolean/string, the CSS class to be applied to the grid when loading via pjax. If set to false - no css class will be applied. If it is empty, null, or set to true, will default to kv-grid-loading. - beforeGrid: _string_, any content to be embedded within pjax container before the Grid widget. - afterGrid: _string_, any content to be embedded within pjax container after the Grid widget.
public $pjaxSettings

$replaceTags public property

tags to replace in the rendered layout. Enter this as $key => $value pairs, where: - $key: _string_, defines the flag. - $value: _string_|_Closure_, the value that will be replaced. You can set it as a callback function to return a string of the signature: function ($widget) { return 'custom'; }. For example, a custom tag like {star} can be set as: php [ '{star}' => '' ]
public $replaceTags

$resizableColumns public property

whether to allow resizing of columns
public $resizableColumns

$resizableColumnsOptions public property

the resizableColumns plugin options
public $resizableColumnsOptions

$resizeStorageKey public property

resizable unique storage prefix to append to the grid id. If empty or not set it will default to Yii::$app->user->id.
public $resizeStorageKey

$responsive public property

whether the grid will have a responsive style. Applicable only if bootstrap is true.
public $responsive

$responsiveWrap public property

whether the grid will automatically wrap to fit columns for smaller display sizes.
public $responsiveWrap

$showPageSummary public property

whether to show the page summary row for the table. This will be displayed above the footer.
public $showPageSummary

$striped public property

whether the grid will have a striped style. Applicable only if bootstrap is true.
public $striped

$tableOptions public property

the HTML attributes for the grid element
public $tableOptions

$toggleData public property

whether to enable toggling of grid data. Defaults to true.
public $toggleData

$toggleDataContainer public property

the HTML attributes for the toggle data button group container. By default this will always have the class = btn-group automatically added, if no class is set.
public $toggleDataContainer

$toggleDataOptions public property

the settings for the toggle data button for the toggle data type. This will be setup as an associative array of $key => $value pairs, where $key can be: - maxCount: int|boolean, the maximum number of records uptil which the toggle button will be rendered. If the dataProvider records exceed this setting, the toggleButton will not be displayed. Defaults to 10000 if not set. If you set this to true, the toggle button will always be displayed. If you set this to false the toggle button will not be displayed (similar to toggleData setting). - minCount: int|boolean, the minimum number of records beyond which a confirmation message will be displayed when toggling all records. If the dataProvider record count exceeds this setting, a confirmation message will be alerted to the user. Defaults to 500 if not set. If you set this to true, the confirmation message will always be displayed. If set to false no confirmation message will be displayed. - confirmMsg: _string_, the confirmation message for the toggle data when minCount threshold is exceeded. Defaults to 'There are {totalCount} records. Are you sure you want to display them all?'. - all: _array_, configuration for showing all grid data and the value is the HTML attributes for the button. (refer page for understanding the default options). - page: _array_, configuration for showing first page data and $options is the HTML attributes for the button. The following special options are recognized: - icon: _string_, the glyphicon suffix name. If not set or empty will not be displayed. - label: _string_, the label for the button. This defaults to the following setting: php [ 'maxCount' => 10000, 'minCount' => 1000 'confirmMsg' => Yii::t( 'kvgrid', 'There are {totalCount} records. Are you sure you want to display them all?', ['totalCount' => number_format($this->dataProvider->getTotalCount())] ), 'all' => [ 'icon' => 'resize-full', 'label' => 'All', 'class' => 'btn btn-default', 'title' => 'Show all data' ], 'page' => [ 'icon' => 'resize-small', 'label' => 'Page', 'class' => 'btn btn-default', 'title' => 'Show first page data' ], ] ```
public $toggleDataOptions

$toolbar public property

the toolbar content configuration. Can be setup as a string or an array. When set as a _string_, it will be rendered as is. When set as an _array_, each line item will be considered as per the following rules: - if the line item is setup as a _string_, it will be rendered as is - if the line item is an _array_, the following keys can be setup to control the rendering of the toolbar: - content: _string_, the content to be rendered as a bootstrap button group. The following special tags in the content are recognized and will be replaced: - {export}, _string_ which will render the [[export]] menu button content. - {toggleData}, _string_ which will render the button to toggle between page data and all data. - options: _array_, the HTML attributes for the button group div container. By default the CSS class btn-group will be attached to this container if no class is set.
public $toolbar