Hi,
How can I add an extra row to the model to the GridView? I would like to have several separate columns for the main row and for some models an additional row with some description. I need this for renderPartial to generate PDF so I can not use JS.
Thanks for the visualization! Now it’s clear what you want to do.
This is not possible by configuring the GridView. You need to extend the class.
The header of GridView is built in renderTableHeader():
extending this method is a bit complicated but as you see above, there is another method which adds content to the header, so you may instead extend renderFilters() and append the row you want:
class MyGridView extends \yii\grid\GridView
{
/**
* Renders the filter.
* @return string the rendering result.
*/
public function renderFilters()
{
$yourRows = '<tr><td>...</td>... </tr>';
return parent::renderFilters() . $yourRows;
}
}