Closed dgtlslave closed 4 years ago
public function export() {
$this->response->download('export.csv');
$data = [
['a', 'b', 'c'],
[1, 2, 3],
['you', 'and', 'me'],
];
$_serialize = 'data';
$this->set(compact('data', '_serialize'));
$this->viewBuilder()->className('CsvView.Csv');
return;
}
Router::extensions(['csv']);
And when I try to start function with uncommeted '_ext' => 'csv' I have an error: Error: Create ProjectsController::export.csv() in file: src/Controller/ProjectsController.php. Above is my button.
`<?= $this->Html->link('save', [
'controller' => 'Projects',
'action' => 'export',
// '_ext' => 'csv'
],
['class' => 'btn btn-success'])
?>`
@dereuromark can you help me? Sorry for the taking time )
If the docs are unclear here, you can also compare yours with sandbox code, what you might have missed.
Thanks. The problem is plugin insert Router::extensions(['csv']); like last row in my routes.php
When I picked up row with csv routes plugin start to work correct
Anything to improve the docs of this plugin here? Otherwise you can close this ticket then.
Hi, I have little problem. CsvView save in csv file only html code, something like that:
<!DOCTYPE html>
... and whole page... Help pls. What did I miss? Thks