kartik-v / yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)
http://demos.krajee.com/export
Other
165 stars 126 forks source link

Closure for contentOptions not acceptable #328

Closed bscheshirwork closed 3 years ago

bscheshirwork commented 4 years ago

Prerequisites

Steps to reproduce the issue

  1. use closure for 'contentOptions' of column
    
        'contentOptions' => function ($model) {
            return [
                'class' => 'text-break',
                'data-toggle' => 'tooltip',
                'data-placement' => 'top',
                'title' => someFunctionalForGenerateTitle($model),
            ];
        },

2. click download btn
3. have error in 
vendor/kartik-v/yii2-export/src/ExportMenu.php:1394

## Expected behavior and actual behavior

When I follow those steps, I see...
Error

I was expecting...
pick `class` from closure result

## Environment

#### Browsers

- [ ] Google Chrome
- [ ] Mozilla Firefox
- [ ] Internet Explorer
- [ ] Safari

#### Operating System

- [ ] Windows
- [ ] Mac OS X
- [ ] Linux
- [ ] Mobile

#### Libraries

- jQuery version:
- yii2-export version:

## Isolating the problem

- [ ] This bug happens [on the demos page](https://demos.krajee.com/export-demo)
- [x] The bug happens consistently across all tested browsers
- [x] This bug happens when using yii2-export without other plugins.

<bountysource-plugin>

---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/92280386-closure-for-contentoptions-not-acceptable?utm_campaign=plugin&utm_content=tracker%2F7668315&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F7668315&utm_medium=issues&utm_source=github).
</bountysource-plugin>
kartik-v commented 3 years ago

Fixed via #329.