YII2 Activedataprovider custom template

Hello all,

Let’s assume that we have three tables, tbl_student ,tbl_lesson and tbl_score(student_id, lesson_id, score).

for Activedataprovider, we have:

$query = \app\models\Score::find()

	->joinWith('student', false)

	->joinWith('lesson', false);

$provider = new \yii\data\ActiveDataProvider([

	'query' => $array,


echo GridView::widget([

    'dataProvider' => $dataProvider,


So it gives an output with columns : student_id, lesson_id, score.

But what I want is to display students in the first COLUMN, and lessons in the first ROW and then display the associated scores in the body of the table.

How can I do that?

Thanks in advance.

[color="#006400"]/* Moved from Tutorials forum … */[/color]