Triggering POST request from GridView

Hi all,

I’ve got stuck on a weird one.

I’m generating a gridview where one of the columns consists of document references (numeric values) as links to a separate controller action which triggers download for relevant document. Those links are generated with Html::a method within a closure.

Although I’ve got ‘data-method’ => ‘post’ set up for the link config, the request gets triggered as GET. It helps if I place the links within yii\grid\ActionColumn (POST request gets fired) but then I loose the ability of sorting the column.

Am I missing something? Is there a workaround to be able to fire POST request from a column without making it ActionColumn?

You may use POST request as it is used in the logout link in the main page of the framework (which is shipped with the framework).

thanks for the suggestion but this would mean generating a form for each of the rows in the grid which is not ideal…

in my opinion the data-method configuration option shouldn’t get ignored in the first place but it might be just me missing something