kartik-v / yii2-grid

Enhanced GridView with various utilities for Yii Framework 2.0
http://demos.krajee.com/grid
Other
557 stars 302 forks source link

subGroupOf 2nd, 3rd level in 3.3.6 #971

Closed nimer- closed 3 years ago

nimer- commented 3 years ago

Prerequisites

Libraries

Steps to reproduce the issue

There is still an issue with subgroups of 2nd, 3rd level. It does not work without groupfooter attribute. (Actually there is closed issue for this, but it was closed because you could not reproduce it and it was not well documented - posted reply there 2 months ago - so i am trying again)

using your example from: https://demos.krajee.com/group-grid-demo/7 :

echo GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => null,
    'showPageSummary' => true,
    'pjax' => true,
    'hover' => true,
    'panel' => ['type' => 'primary', 'heading' => 'Grid Grouping Example'],
    'toggleDataContainer' => ['class' => 'btn-group mr-2'],
    'columns' => [
        // note that you MUST NOT have the first column as a grid group
        // to achieve that add a dummy hidden column like shown below
        ['class' => 'kartik\grid\SerialColumn', 'hidden' => true],
        ['attribute' => 'year',  'group' => true, 'groupFooter' => $gfYear, 'pageSummary' => 'Page Summary'],
        ['attribute' => 'month',  'group' => true, 'subGroupOf' => 1, 'groupFooter' => $gfMonth],
        ['attribute' => 'cat',  'group' => true, 'subGroupOf' => 2, 'groupFooter' => $gfCategory],
        ['attribute' => 'region',  'group' => true, 'subGroupOf' => 3, /*'groupFooter' => $gfRegion*/],
        ['attribute' => 'id', 'label' => 'ID', 'hAlign' => 'center', 'width' => '150px'],
        ['attribute' => 'amount', 'label' => 'Amount ($)', 'format' => ['decimal',  2], 'hAlign' => 'right', 'width' => '150px', 'pageSummary' => true],
    ],
]);

it looks like this: grid-group

Emptied cache, tried different browsers, different computers actually, but it persists.

kartik-v commented 3 years ago

@nimer the example works fine as seen in this group demo # 7 - you may need to check if you have the latest code. Can you cross check the gridview JS assets that are being loaded on the page for your app and compare it with the assets loaded on the demo site link above and confirm they are same

nimer- commented 3 years ago

@kartik-v You are correct with the latest version of code. I am using non-minified (for dev purposes) and on the demo page is minified. As seen here: https://github.com/kartik-v/yii2-grid/blob/master/src/assets/js/kv-grid-group.js and here https://github.com/kartik-v/yii2-grid/blob/master/src/assets/js/kv-grid-group.min.js There are different versions (3.2.7 for non minified and 3.3.6 for minified version) in master branch. Minified version of code is working fine. 👍

kartik-v commented 3 years ago

It should work with the non-minified source as well ... actually the PHP Doc version 3.2.7 is a typo error and will correct it.

For the non-minified source - it seems some cache issue at your end loading old obsolete assets.