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