Downloading file from custom element action I'm trying to download a CSV file from a custom created element action

Here's the performAction function

    public function performAction(ElementCriteriaModel $criteria) {
        $contents = 'row1column1,row2column2'.PHP_EOL.'row2column1,row2column2'.PHP_EOL;

        craft()-&gt;request-&gt;sendFile('export.csv', $contents, array('forceDownload' =&gt; true), false);

        return true;  
    }


No error is thrown, the code passes right through the function. When I check the craft logs, there's no sign of any error

And yet, there's no download occuring. When I try this same code in a controller or a service, it works just fine. But in this element action class, nothing happens
It's because those element actions happen over an AJAX and you have to jump through a few hoops to send a file to the browser over an AJAX request.