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

Issue with Closure in contentOptions for ExpandRowColumn starting from v3.2.9 #991

Closed
9 of 17 tasks
VladimirBarabash opened this issue Aug 20, 2021 · 0 comments
Closed
9 of 17 tasks
Labels

Comments

@VladimirBarabash
Copy link

VladimirBarabash commented Aug 20, 2021

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

  1. Render kartik\grid\GridView with kartik\grid\ExpandRowColumn with Closure in contentOptions:
echo kartik\grid\GridView::widget([
    ...
    'columns' => [
        [
            'class' => 'kartik\grid\ExpandRowColumn',
            'value' => function ($model, $key, $index, $column) {
                return GridView::ROW_COLLAPSED;
            },
            'detailUrl' => Url::to(['/update']),
            'contentOptions' => function ($model, $key, $index, $widget) {
                return $model->isHighlighted ? ['class' => 'highlighted'] : [];
            },
        ],
        ...
    ],
]);
  1. Open page in browser

Expected behavior and actual behavior

When I follow those steps, I see "Error. Cannot use object of type Closure as array":
error

I was expecting no error message, Closure in contentOptions working for ExpandRowColumn like in version 3.2.8

Environment

Browsers

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Safari

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version: 2.2.4
  • yii2-grid version: 3.2.9, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5, dev-master

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.

There is no bug in version 3.2.8. There is bug in versions 3.2.9-3.3.5, dev-master

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