sendfile inside of pjax widget

I have a pjax widget where I display links to files on the server:



        echo "<div class='container' id='files'>";

        foreach ($model->files as $file)




        echo "</div>";



The resulting html code looks like this:

<div id="w2"><div class='container' id='files'><span id="w3" data-plugin-name="contextmenu" data-plugin-options="contextmenu_f9217b71">

<a href="/lims/index.php?r=file%2Fdownload&amp;id=19" target="_top"><div class="col-md-2" style="margin-bottom: 20px; text-align: center;"><i class="fa-3x fa fa-file-image-o"></i> <br>C K Relative Signal.tif</div></a></span>

When I click on the link, the following code is executed to send the file:

 Yii::$app->response->xSendFile($this->FullFilename, $this->filename,['mimeType' => FileHelper::getMimeType($this->FullFilename), 'inline' => false]);

However, as long as I put the link inside of the pjax widget, the file gets rendered inside of that widget instead being downloaded as a file. Only when I remove the pjax widget does it work correctly (but breaking the other code that needs the pjax widget). I’m guessing that the pjax widget always interprets the file as something it needs to render. Is there a way around this problem?


Tried adding a linkSelector to the pjax code, didn’t help either:

 Pjax::begin(['clientOptions' =>['linkSelector' => 'a.dummy']]);

This one seems to work:

Pjax::begin([‘linkSelector’ => ‘a.dummy’]);