Yii2 GridView on steroids. A module with various modifications and enhancements to one of the most used widgets by Yii developers. The widget contains new additional Grid Columns with enhanced settings for Yii Framework 2.0. The widget also incorporates various Bootstrap 3.x styling options. Refer detailed documentation and/or a complete demo.
NOTE: This extension depends on the kartik-v/yii2-widgets extension which in turn depends on the yiisoft/yii2-bootstrap extension. Check the composer.json for this extension's requirements and dependencies. Note: Yii 2 framework is still in active development, and until a fully stable Yii2 release, your core yii2-bootstrap packages (and its dependencies) may be updated when you install or update this extension. You may need to lock your composer package versions for your specific app, and test for extension break if you do not wish to auto update dependencies.
The extension has been created as a module to enable access to advanced features like download actions (exporting as csv, text, html, or xls). You should configure the module with a name of gridview
as shown below:
'modules' => [
'gridview' => [
'class' => '\kartik\grid\Module'
]
],
The following functionalities have been added/enhanced:
Control various options to style your grid table.
Allows the grid table to have a floating table header. Uses the JQuery Float THead plugin to display a seamless floating table header.
Allows configuration of GridView to be enclosed in a panel that can be styled as per Bootstrap 3.x. The panel will enable configuration of various sections to embed content/buttons, before and after header, and before and after footer.
This is a new feature added to the GridView widget. The page summary is an additional row above the footer - for displaying the summary/totals for the current GridView page. The following parameters are applicable to control this behavior:
showPageSummary
: boolean whether to display the page summary row for the grid view. Defaults tofalse
.pageSummaryRowOptions
: array, HTML attributes for the page summary row. Defaults to['class' => 'kv-page-summary warning']
.
This is a new feature added to the GridView widget. It allows you to export the displayed grid content as HTML, CSV, TEXT, or EXCEL. It uses the rendered grid data on client to convert to one of the format specified using JQuery. This is supported across all browsers.
The default Yii data column has been enhanced with various additional parameters. Refer documentation for details.
This is a new grid column class that extends the \kartik\grid\DataColumn class. It allows calculating formulae just like in spreadsheets - based on values of other columns in the grid. The formula calculation is done at grid rendering runtime and does not need to query the database. Hence you can use formula columns within another formula column. Refer documentation for details.
This is a new grid column class that extends the \kartik\grid\DataColumn class. It automatically converts boolean data (true/false) values to user friendly indicators or labels (that are configurable). Refer documentation for details.
Enhancements of \yii\grid\ActionColumn
to work with the new pageSummary and a default styling to work for many scenarios. Refer documentation for details.
Enhancement of \yii\grid\SerialColumn
to work with the new pageSummary and a default styling to work for many scenarios. Refer documentation for details.
Enhancements of \yii\grid\CheckboxColumn
to work with the new pageSummary and a default styling to work for many scenarios. Refer documentation for details.
You can see detailed documentation and demonstration on usage of the extension.
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require kartik-v/yii2-grid "dev-master"
or add
"kartik-v/yii2-grid": "dev-master"
to the require
section of your composer.json
file.
use kartik\widgets\GridView;
yii2-grid is released under the BSD 3-Clause License. See the bundled LICENSE.md
for details.