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

HTML appears in result if the ExportMenu widget is within a view's $this->render function. #313

Closed chaslain closed 4 years ago

chaslain commented 4 years ago

I am having issues with HTML appearing inside an export's file. I saw other people having this issue, changing out output buffering didn't correct it, and I have verified that the HTML is not broken.

I tested by creating a blank view file, passing the dataProvider to it with $this->render in the view, and HTML appears in the result. Another ExportMenu on the same page with the same configuration does not have the issue if it is outside of render. Here is my test view:

<?php

use kartik\export\ExportMenu;

echo ExportMenu::widget(['dataProvider' => $dataProvider]);

Here is the code, in the top-level view, of rendering that page: echo $this->render('test', ['complianceViolations' => $complianceViolations, 'dataProvider' => $complianceDataProvider]);

Finally, here is the code in the top-level view where the rendering works as expected: echo ExportMenu::widget(['dataProvider' => $complianceDataProvider]);

Hope this can help your software.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/87984264-html-appears-in-result-if-the-exportmenu-widget-is-within-a-view-s-this-render-function?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).
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.