Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groupFooter.content.GridView::F_SUM prints "f_sum" #1058

Open
9 of 17 tasks
maxxer opened this issue Mar 14, 2023 · 2 comments
Open
9 of 17 tasks

groupFooter.content.GridView::F_SUM prints "f_sum" #1058

maxxer opened this issue Mar 14, 2023 · 2 comments
Labels

Comments

@maxxer
Copy link
Contributor

maxxer commented Mar 14, 2023

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest master branch of yii2-grid.
  • This is not an usage question. I confirm having gone through and read the documentation and demos.
  • This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional).

Steps to reproduce the issue

echo GridView::widget([
    'filterModel' => $searchModel,
    'dataProvider' => $dataProvider,
    'columns' => [
        [
            'attribute' => 'company',
            'group' => true,
            'groupFooter' => function ($model, $key, $index, $widget) {
                return [
                    'mergeColumns' => [[0, 1, 2]],
                    'contentOptions' => [
                        0 => ['style' => 'font-weight: bold;'],
                        3 => ['style' => 'text-align: right;'],
                    ],
                    'content' => [
                        0 => $model['company'],
                        3 => GridView::F_SUM,
                    ],
                ];
            },
        ],
        'title',
        [
            'attribute' => 'start_time',
            'format' => 'dateTime',
            'hAlign' => 'right',
        ],
        [
            'attribute' => 'tracking_minutes',
            'format' => 'duration',
            'hAlign' => 'right',
        ],
    ],
]);

Expected behavior and actual behavior

immagine

I don't know if it matters, the ActiveDataProvider query comes from a (new Query) and not from an AR find()

Environment

Browsers

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Safari

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version: v3.6.3
  • yii2-grid version: c407f8e

Isolating the problem

  • This bug happens on the demos page
  • The bug happens consistently across all tested browsers
  • This bug happens when using yii2-grid without other plugins.
@maxxer
Copy link
Contributor Author

maxxer commented Mar 27, 2023

A friend appointed me the F_SUM feature works in javascript, so with plain integer/float values. I tied removing the format option from all columns, but still won't sum

@kartik-v
Copy link
Owner

kartik-v commented Mar 29, 2023

Yes the F_SUM (means a numeric summation) and needs a numeric value in each cell in the specific Grid DataColumn for summary to be mathematically possible. You need to ensure that the DataColumn value is numeric and you can use the DataColumn content property to format the data content for display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants