The yii2-dynagrid module is a great complementary addition to the kartik-v/yii2-grid module, enhancing it with personalization features. It turbo charges your grid view by making it dynamic and personalized for each user. It allows users the ability to set and save their own grid configuration. The major features provided by this module are:
DynaGridStore
object to manage dynagrid personalizations independent of storage. One of the following storage options are made available to store
the personalized grid configuration:
NOTE: This extension depends on the kartik-v/yii2-grid and kartik-v/yii2-sortable extensions which in turn depends on the yiisoft/yii2-bootstrap extension. Check the composer.json for this extension's requirements and dependencies.
Refer the CHANGE LOG for details on changes to various releases.
DynaGridStore
object and ability to save, update, or delete grid personalizations including grid filter and sort.gridOptions['pjax']
property to true
and control pjax behavior using gridOptions['pjaxSettings']
.Refer this git workflow for contributors.
You can see detailed documentation, view the API Code Documentation or view a complete demo on usage of the extension.
The preferred way to install this extension is through composer.
Note: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the
minimum-stability
settings for your application's composer.json.
Either run
$ php composer.phar require kartik-v/yii2-dynagrid "@dev"
or add
"kartik-v/yii2-dynagrid": "@dev"
to the require
section of your composer.json
file.
Setup the module in your Yii configuration file with a name dynagrid
as shown below. In addition, you must also register
the gridview
module as described in the yii2-grid documentation.
'modules'=>[
'dynagrid'=>[
'class'=>'\kartik\dynagrid\Module',
// other settings (refer documentation)
],
'gridview'=>[
'class'=>'\kartik\grid\Module',
// other module settings
],
],
The DynaGrid widget can be used to render the personalized & dynamic version of kartik\Grid\GridView
in the following way:
use kartik\dynagrid\DynaGrid;
use kartik\grid\GridView;
$columns = [
['class'=>'kartik\grid\SerialColumn', 'order'=>DynaGrid::ORDER_FIX_LEFT],
'id',
'name',
[
'attribute'=>'publish_date',
'filterType'=>GridView::FILTER_DATE,
'format'=>'raw',
'width'=>'170px',
'filterWidgetOptions'=>[
'pluginOptions'=>['format'=>'yyyy-mm-dd']
],
],
[
'class'=>'kartik\grid\BooleanColumn',
'attribute'=>'status',
'vAlign'=>'middle',
],
[
'class'=>'kartik\grid\ActionColumn',
'dropdown'=>false,
'order'=>DynaGrid::ORDER_FIX_RIGHT
],
['class'=>'kartik\grid\CheckboxColumn', 'order'=>DynaGrid::ORDER_FIX_RIGHT],
];
echo DynaGrid::widget([
'columns'=>$columns,
'storage'=>DynaGrid::TYPE_COOKIE,
'theme'=>'panel-danger',
'gridOptions'=>[
'dataProvider'=>$dataProvider,
'filterModel'=>$searchModel,
'panel'=>['heading'=>'<h3 class="panel-title">Library</h3>'],
],
'options'=>['id'=>'dynagrid-1'] // a unique identifier is important
]);
Warning: You need to be careful, in case you are using the new
\kartik\grid\FormulaColumn
in your grid layout. The reordering of columns by users will render your formulae invalid, since the column indices will change. It is recommended, you set the order of all such formulae columns and its dependencies toDynaGrid::ORDER_FIX_LEFT
, so that such column positions are pre-fixed.
yii2-dynagrid is released under the BSD-3-Clause License. See the bundled LICENSE.md
for details.
yii2-dynagrid
Date: 25-Jul-2023.
Date: 29-Apr-2022
Date: 04-Mar-2022
Date: 03-Sep-2021
Date: 24-Feb-2019
Date: 11-Sep-2018
Date: 10-Sep-2018
src
directory.Date: 15-Feb-2018
Date: 23-Oct-2017
Date: 15-Sep-2017
false
.Date: 07-Apr-2017
getAttributeOrders
for sort.getColumns
method.Date: 04-Aug-2015
initS2Loading
.Date: 16-Jun-2015
pagination
and sort
for the grid.allowPageSetting
.Date: 22-May-2015
allowThemeSetting
is false
.allowThemeSetting
to allow display/setup of theme.Date: 13-Feb-2015
Date: 12-Jan-2015
{
in DynaGridDetail.Date: 25-Nov-2014
Date: 25-Oct-2014
Date: 19-Sep-2014
Date: 01-May-2014
Initial release (01-May-2014). The major features provided by the yii2-dynagrid module are:
Additional Fixes in v1.0.0:
showPersonalize
is false.showPersonalize
property to configure whether personalize will be shown.
Comments